http://www.perlmonks.org?node_id=1052436


in reply to Re: Removing duplicates lines
in thread Removing duplicates lines

Small remark.

foreach my $line ( <FILE> )  #### do NOT read entire files into memory if they are big.

With foreach, you ARE reading the whole file into memory!

Use while:

while ( my $line = <FILE> )