Processing line by line in a while loop is a a more scaleable solution but I would prefer to separate the line skipping part from the main line processing logic. I think it keeps things clearer but others may disagree.
my $linesToSkip = 14; my $discard = <$file> for 1 .. $linesToSkip; while( my $line = <$file> ) { chomp $line; ... }
Calling the scalar $discard makes it clear that it is something we are not interested in whereas $line might be something we want to work with.
I hope you find these thoughts of interest.
Cheers,
JohnGG
In reply to Re^2: reading file into an array
by johngg
in thread reading file into an array
by vassago
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |