in reply to Re: match pattern from two different file
in thread match pattern from two different file
thank u code but it retrieve "nothing to print" multiple times I also tried again by using split().but it also print same as ur code newly written code
#!/usr/bin/perl use strict; use warnings; open(FH, "outputps_scan_chr1_.out") or die "Can't Open File1\n"; my @array1=<FH>; close(FH); open(BH, "chr1_1.txt") or die "Can't Open File2\n"; my @array2=<BH>; close(BH); my $pat='qr/^LOC_Os0.../'; foreach my $line1(@array1) { my @array3= split(/ /, $line1); foreach my $line2(@array2) { my @array4= split(/ /, $line2); foreach my $line3(@array3) { foreach my $line4(@array4) { $line3=~ $pat; $line4=~ $pat; if ($line3 eq $line4) { print $line3; } else { print "nothing to right\n"; } } } } }
|
|---|