--- cherukuwada subrahmanyam <[EMAIL PROTECTED]> wrote:
> Hi,
> Iam reading flat text file of 100000 lines. Each line has got data of
> maximum 10 characters.
> I want to eliminate duplicate lines and blank lines out of that file.
> i.e. something like sort -u in unix.

Got plenty of memory? =o)

open IN, $file or die $!;
my %uniq;
while(<IN>) {
  $uniq{$_}++;
}
print sort keys %uniq;

> Example:
> if the file contains:
> abcdef
> 
> dfsdf
> abcdef
> 
> dfsdf
> 12334
> Then the output should be:
> abcdef
> dfsdf
> 12334
> 
> 
> Is there any easy way of doing it in perl???
> thanks,



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Reply via email to