#! usr/bin/perl #this script is to match the two files and print the matched content in the two files $p="FILEA"; open (FILE1,$p); @array =; #print "@array"; $p1="FILEB"; open (FILE2,$p1); @new = ; #print "@new"; foreach $line (@array) { chomp $line; open (OUT,">nrset.txt"); for($i=0;$i<@new;$i++) { chomp $new[$i]; # print "$new[$i]\n"; if ($new[$i] =~ /$line/i) { $pos = $i; print "$pos\n"; print OUT "$new[$i]\n$new[$i+1]\n"; # print "$new[$i]\n$new[$i+1]\n"; } }}