The problem is one of these two lines, most likely the first one:
open(FILE, "<\HPRD_FLAT_FILES_090107\PROTEIN_Architecture.txt") or die +("Unable to open file"); open(OUTPUT1, ">$output") or die("Unable to open file");
I believe that when perl is installed on a windows machine, it's smart enough to do the right thing when you use forward slashes in a file path rather than backward slashes, so the first of those two lines ought to work if changed to:
$infile = "/HPRD_FLAT_FILES_090107/PROTEIN_Architecture.txt"; open(FILE, "<", $infile) or die("Open failed for reading $infile: $!");
In case the error came from the second line, you'll find it easier to track down if you craft the error messages to be more clear about where the problem occurs:
open(OUTPUT1, ">", $output) or die "Open failed for writing $output: $ +!");
BTW, since the file you are trying to open for input comes from a tar file that you have already loaded into memory, why not just get the txt file from the tar object? Take a closer look at Archive::Tar (and it might not be too shameless for me to point out an article about this module in the Reviews section). You'll find a way to get the file content directly from the tar object -- you can still use "extract" to unpack the content in your disk directory if you want, but the file you are looking for is already in memory, so you could do something like:
@hprdArchi = split /\n/,$tar->get_content("HPRD_FLAT_FILES_090107/PROT +EIN_Architecture.txt");

In reply to Re: problem opening file by graff
in thread problem opening file by koleti

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.