hi all, i have to take each line from file 1, and search for that line in file2 and file3 along with its sequences.
file1: string11 seq33 string123 seq334 string12 seq32 file2: >string11 AGCTAGCTG CAGAGTC >string123 AGCTGAAGA >string12 AGCGATTATCGA AGCATGAAGACC ACAGCATGACTA file3: >seq32 AGAAGCTCCTAGCT >seq334 AGCTGAAGA AAAGCTAGA >seq33 AGGATTCGA AAATATGA my program: open(FILE1,"file1.txt"); open(FILE2,"file2.txt") open(FILE3,"file3.txt") @ray1=<FILE2>;$join1=("",@ray1);@list1=split(">",$join1); @ray2=<FILE3>;$join2=("",@ray1);@list2=split(">",$join2); while($s=<FILE1>){ ($one,$two)=split("\s+",$s); @first=grep($one,@ray1); @second=grep($two,@ray2); #<ACTION - CALLING SUBROUTINE> #i should have only 2 sequences here for every loop. }
this program is not fetching only 2 sequences at a time inside the loop, so when i want to pass only 2 sequences(@first and @second) to subroutine, i get mistakes. please give some suggestions.

In reply to grep the whole element in an array 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.