First, don't use Perl. It's not for someone like you. Use Python. There is a reason why it's so widely used - it's MUCH more resistant to attempts to write horrible garbage code like yours. Python is especially suitable for scientists and other non-programmers (it's ok for programmers also).

For one thing (as already mentioned), the line

open OUT,'>'."$path/$name.faa" || die ("cannot open out $file $!\n");

isn't parsed like you think it is, due to precedence of operators. Specifically, || has higher precedence than comma, so it's parsed like

open OUT, ('>'."$path/$name.faa" || die ("cannot open out $file $!\n" +));

This will never die.

Second - I suppose that's the real problem - you(?) are setting the global variable $/

$/ = "\>";

and then never restoring it back to "\n". I don't see how "it reads the other lists and tell how many od each list's ID are found in the FASTA file" is possible. You're probably confused.

There is more, albeit relatively harmless (like not resetting $found or chomping stuff from @lista twice). Not even to mention broken indentation. It seems the script consists of two parts, the first part (ending with chomp(my @data = <INFILE>) is old school, but relatively reasonable, the next part is yours.

Anyway, Guido was right and Larry failed.


In reply to Re: Extract multiple lists od Identifiers from a FASTA file by Anonymous Monk
in thread Extract multiple lists od Identifiers from a FASTA file by joluito

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.