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"; } } } } }

In reply to Re^2: match pattern from two different file by Anonymous Monk
in thread match pattern from two different file by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.