in reply to Re: reading file into an array
in thread reading file into an array
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 Section
Seekers of Perl Wisdom