how to read fixed length records in perl

how to read fixed length records in perl

am 01.11.2005 17:27:05 von David Wolf

I know I can use:

while (<>){
....
}

to read each line of the input file,

but, how to read fixed length records that have no "new line" in the
file at all?

Re: how to read fixed length records in perl

am 01.11.2005 17:37:00 von Paul Lalli

david wolf wrote:
> I know I can use:
>
> while (<>){
> ...
> }
>
> to read each line of the input file,
>
> but, how to read fixed length records that have no "new line" in the
^^^^
> file at all?

You have just asked a SAQ (Self-Answering Question)

perldoc -f read

Paul Lalli

Re: how to read fixed length records in perl

am 01.11.2005 22:41:17 von David Wolf

Sorry for the silly question, I am just a programmer starting on perl.

Re: how to read fixed length records in perl

am 02.11.2005 01:21:12 von someone

david wolf wrote:
> I know I can use:
>
> while (<>){
> ...
> }
>
> to read each line of the input file,
>
> but, how to read fixed length records that have no "new line" in the
> file at all?

$/ = \256; # Set IRS to fixed length records

while ( <> ) {
...
}



John
--
use Perl;
program
fulfillment

Re: how to read fixed length records in perl

am 02.11.2005 11:36:28 von Joe Smith

david wolf wrote:
> Sorry for the silly question, I am just a programmer starting on perl.

The question you should have been asking yourself is "Where can I
find a list of Perl's operators and built-in functions?" There are
several at your disposal. You really ought to familiarize yourself
with those before continuing.

perldoc perlfunc
perldoc perlop
perldoc perlrun
perldoc perlvar


-Joe