Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: reading lines from 2 different files

by mwah (Hermit)
on Oct 08, 2007 at 15:59 UTC ( [id://643489]=note: print w/replies, xml ) Need Help??


in reply to reading lines from 2 different files

my @Fn = qw' bigfile1.txt bigfile2.txt '; open my $f1, '<', $Fn[0] or die "$Fn[0] $!"; open my $f2, '<', $Fn[1] or die "$Fn[1] $!"; while( defined(my $l1 = <$f1>) && defined(my $l2 = <$f2>)) { # chomp here, but only if necessary print "line $. is ", $l1 cmp $l2 ? "different!" : "identical!", " +\n" } close $f1, close $f2;
Regards

mwa

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-16 11:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found