in reply to File Compare

1. see File::Compare - Compare files or filehandles

2. Or you can try something like,
my %data_hash; open(my $fh, '<', "datafile.txt") or die $!; while(<$fh>){ $data_hash{$_} = 1; } close($fh); open(my $fh1, '<', "tmpfile.txt") or die $!; while(<fh1>){ if(defined($data_hash{$_})){ print"Line match"; }else{ print"Line not match"; } } close($fh2); close($fh1);

Replies are listed 'Best First'.
Re^2: File Compare
by Cicatrix (Novice) on Mar 23, 2011 at 06:51 UTC
    hi nikhil. thanks for that snippet!! thats working fine, but i'm want to print the matched pattern into another file. not just saying its a match. how can u do that?? please help !!