Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: reading lines from 2 different files

by mwah (Hermit)
on Oct 08, 2007 at 15:59 UTC ( #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? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2023-03-27 23:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (66 votes). Check out past polls.

    Notices?