in reply to Memory usage while tallying instances of lines in a .txt file
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