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:open(FILE, "<\HPRD_FLAT_FILES_090107\PROTEIN_Architecture.txt") or die +("Unable to open file"); open(OUTPUT1, ">$output") or die("Unable to open file");
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:$infile = "/HPRD_FLAT_FILES_090107/PROTEIN_Architecture.txt"; open(FILE, "<", $infile) or die("Open failed for reading $infile: $!");
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:open(OUTPUT1, ">", $output) or die "Open failed for writing $output: $ +!");
@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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |