Perl-Sensitive Sunglasses | |
PerlMonks |
Re^3: What does 'next if $hash{$elem}++;' mean?by inman (Curate) |
on Feb 17, 2006 at 15:51 UTC ( [id://530980]=note: print w/replies, xml ) | Need Help?? |
It isn't necessary to do all of the intermediate processing. You can read a line and check it all at the same time.
The line is used as a hash key. The value is tested before being incremented and the line is added to the array.
This is OK if the hash doesn't grow to big. Using MD5 hashes of lines is an uesful technique.
In Section
Seekers of Perl Wisdom
|
|