The line is used as a hash key. The value is tested before being incremented and the line is added to the array.
my %seen; while (<PROCESSED_FILE>){ push @unique, $_ unless $seen{$_}++; }
This is OK if the hash doesn't grow to big. Using MD5 hashes of lines is an uesful technique.
In reply to Re^3: What does 'next if $hash{$elem}++;' mean?
by inman
in thread What does 'next if $hash{$elem}++;' mean?
by Win
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |