| Author |
how to read fixed length records in perl
|
|
| david wolf 2005-11-01, 6:56 pm |
| 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?
| |
| Paul Lalli 2005-11-01, 6:56 pm |
| 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
| |
| david wolf 2005-11-01, 6:56 pm |
| Sorry for the silly question, I am just a programmer starting on perl.
| |
| John W. Krahn 2005-11-01, 6:56 pm |
| 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
| |
| Joe Smith 2005-11-02, 7:56 am |
| 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
|
|
|
|