Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Are two lines in the text file equal

by kelan (Deacon)
on Nov 13, 2003 at 00:30 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-24 21:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found