in reply to 'open for read' fails as "no such file or directory" but file is there
You can try to see exactly what file perl tries to open and print it in the error message by doing the interpolation in a temporary variable:
Once this is done, you can replace the single quotes by double quotes, as strings in single quotes are used literally and no interpolation happens (perl doesn't replace the variables by their value).my $file = '/Users/athina/check-ma/$ID${l}/F${j}\/gangle-dihedrals-${i +}${id}${k}.xvg'; open $input, '<', $file or die "Can't open file $file: $!";
The variable with the file name is a good habit to have, so that you can have the exact same string used by open and printed in the error without having to assume that you and perl are looking at the same file.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: 'open for read' fails as "no such file or directory" but file is there
by fasoli (Beadle) on Nov 02, 2016 at 13:00 UTC | |
by talexb (Chancellor) on Nov 02, 2016 at 13:31 UTC | |
by kcott (Archbishop) on Nov 02, 2016 at 20:40 UTC | |
by talexb (Chancellor) on Nov 02, 2016 at 21:09 UTC |