I'm guessing that the reason for the open failure is that the correct path should be something like this.

/Users/lomSpace/Desktop/Pipelines/
I'll assume that below. The advice other monks have given is excellent if you are using the traditional open function, but in the spirit of "there is more than one way to do it" here is another approach.

The module Path::Tiny is great, and I tend to look to it first when opening files. After installing it, the following could be done.

... use Path::Tiny; my $in = path('/Users/lomSpace/Desktop/Pipelines/fungi.1.aa.hypothetic +al.faa')->slurp; my $out = path('/Users/lomSpace/Desktop/Pipelines/fungi.1.aa.hypotheti +cal50.faa')->openw; my @chunks = split(/>/, $in); ...
The slurp method on the input file path eliminates the need for local $/ = undef; in your code and the readline, that is the angle bracket pair inside the split. It does mean that $in is no longer a filehandle while $out still is so it might be worth renaming one of the variables to make that clear.

Path::Tiny also croaks automatically on failure with good error messages. One small downside to it may be that it is not in the core and must be installed from CPAN. Besides opening files, Path::Tiny performs other useful functions as well.


In reply to Re: Parsing Sequence Records by farang
in thread Parsing Sequence Records by lomSpace

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.