Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Are two lines in the text file equal

by kelan (Deacon)
on Nov 13, 2003 at 00:30 UTC ( #306690=note: print w/replies, xml ) Need Help??


in reply to Are two lines in the text file equal

How about this (untested):

open LOG, '<', 'somelog' or die $!; my %tracker; my $line; while ($line = <LOG>) { push @{ $tracker{$line} }, $.; } close LOG; for my $key (keys %tracker) { print "Lines ", join(', ', @{$tracker{$key}}), " are the same.\n" if (@{ $tracker{$key} } > 1); }

kelan


Perl6 Grammar Student

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://306690]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2022-12-03 22:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?