"be consistent" | |
PerlMonks |
Re: Memory usage while tallying instances of lines in a .txt fileby SuicideJunkie (Vicar) |
on Dec 05, 2016 at 16:47 UTC ( [id://1177245]=note: print w/replies, xml ) | Need Help?? |
Change the while into while (my $line = <$IFH>) along with the corresponding references to $_ to $line. Also, there doesn't seem to be any need to test for the existence of the hits keys; simply let them autovivify. You can use ...{w}//0 and ...{c}//0 when printing in case there was only one of the values incremented. That will simplify your main loop to three lines.
In Section
Seekers of Perl Wisdom
|
|