Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
What I need to do is compare Data1 file with Data2 file and print the different on Data3 file, I only print the name of the person, so My Data3 will look like this--DATA1-- --DATA2-- Monk Apple One Sam Orange Two Sam Orange Two Sue Apple One Sue Apple One Monk Apple One Mike Bannana One Don Apple Two
I was following an approach of using arrays--DATA3-- Don Mike
Not finding the difference between the two files. Can someone help ? thanks a lotmy @Found = (); while (my $line = <DATA1>) { chomp $line1; while (my $line2 = <DATA2>) { chomp $line2; if ("$line1" eq "$line2") {} else { push @Found, $line2 } } } open (DATA3, "data3") or die; { print @Found; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: comparing two files
by Roy Johnson (Monsignor) on Mar 09, 2004 at 15:49 UTC | |
|
Re: comparign two files
by Limbic~Region (Chancellor) on Mar 09, 2004 at 15:55 UTC | |
|
Re: comparign two files
by TomDLux (Vicar) on Mar 09, 2004 at 16:03 UTC | |
by Happy-the-monk (Canon) on Mar 09, 2004 at 19:48 UTC | |
|
Re: comparign two files
by graff (Chancellor) on Mar 10, 2004 at 05:43 UTC |