in reply to Re^5: comparing contents of the file
in thread comparing contents of the file
#!/usr/bin/perl use strict; use warnings; my %lines; open F1, "File.txt"; while(my $result= <F1>) { $lines{$result}=1; } close(F1); open (OF1, ">match.txt"); open (OF2, ">diff.txt"); open F2,"File2.txt"; while(<F2>) { if (defined $lines{$_}) { print OF1 $_; } else { print OF2 $_; } } close OF1; close OF2;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: comparing contents of the file
by graff (Chancellor) on Jun 04, 2008 at 23:27 UTC | |
by Ms.Ranjan (Initiate) on Jun 05, 2008 at 20:48 UTC |