N
nun
I need to read lines from an ASCII flat file in the following format :
1 to 4 - code (length= 4)
5 to 24 - number (length=20)
25 to 54 - description (length=30)
55 to 62 - p1 (length= 8)
71 to 78 - p2 (length= 8)
104 to 123 - New number (length=20)
124 to 124 - flag (length= 1)
Here's an example line of the file which will no doubt wrap in this post:
PQ AMERICAN SERIES CATFISH 0.000
0.000 L11115 2
Now in another script, I was reading in comma-separated values from a
file like this:
#################################
# reading data in from file
my (@AoA);
while ( <> ) {
chomp;
push @AoA, [ split /,/ ];
}
#################################
and I want to do the same thing with this fixed-length data. My reading
online suggests that I could accomplish this using unpack, or
Text::FixedLength but I'm not sure which is best. Can anyone provide
guidance or an example?
DB
1 to 4 - code (length= 4)
5 to 24 - number (length=20)
25 to 54 - description (length=30)
55 to 62 - p1 (length= 8)
71 to 78 - p2 (length= 8)
104 to 123 - New number (length=20)
124 to 124 - flag (length= 1)
Here's an example line of the file which will no doubt wrap in this post:
PQ AMERICAN SERIES CATFISH 0.000
0.000 L11115 2
Now in another script, I was reading in comma-separated values from a
file like this:
#################################
# reading data in from file
my (@AoA);
while ( <> ) {
chomp;
push @AoA, [ split /,/ ];
}
#################################
and I want to do the same thing with this fixed-length data. My reading
online suggests that I could accomplish this using unpack, or
Text::FixedLength but I'm not sure which is best. Can anyone provide
guidance or an example?
DB