There's more than one way to do things | |
PerlMonks |
Re^5: Parsing Guassian '03 Log Filesby GrandFather (Saint) |
on Jan 31, 2008 at 20:25 UTC ( [id://665433]=note: print w/replies, xml ) | Need Help?? |
You can clean that up a little:
Your version had some rather odd constructs. The pop loops to clear out arrays were perhaps the strangest. Much better to:
The while loop to slurp the file is better as:
The construct my $infile, my $outfile; is odd. Either my ($var1, $var1); or use two separate statements:
However you should declare your variables as close to their first use as possible so it is not often that you need to declare a bunch of variables in one place like that anyway. See too the file name variable declarations in my version of your code above. You should always use the three parameter version of open and you should always check the result. Perl is environmentally friendly - it saves trees
In Section
Seekers of Perl Wisdom
|
|