in reply to Permission denied when opening files in Windows
I'd recommend adding an 'or die' statement to your open statement like:
open(my $fh2, ">", $output) or die "Unable to open file '$output': $! +\n";
Your code has a check on closing the file, but not on opening the file. Modifying your open statement to something like what I listed above will show you when the code encounters an issue with opening a file. I personally like to use the die message listed above because it will show me both the file name/path that was provided to open as well as the reason for failing to open the file.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Permission denied when opening files in Windows
by Laurent_R (Canon) on Mar 27, 2015 at 19:00 UTC | |
by tye (Sage) on Mar 28, 2015 at 04:44 UTC | |
by dasgar (Priest) on Mar 29, 2015 at 17:13 UTC | |
by Anonymous Monk on Mar 29, 2015 at 18:56 UTC | |
by Laurent_R (Canon) on Mar 30, 2015 at 05:41 UTC |