I'm guessing that the reason for the open
failure is that the correct path should be something like this.
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.
module Path::Tiny is great, and I tend to look to it first when
opening files. After installing it, the following could be done.
my $in = path('/Users/lomSpace/Desktop/Pipelines/fungi.1.aa.hypothetic
my $out = path('/Users/lomSpace/Desktop/Pipelines/fungi.1.aa.hypotheti
my @chunks = split(/>/, $in);
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.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.