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.
In reply to Re: 'open for read' fails as "no such file or directory" but file is there
by Eily
in thread 'open for read' fails as "no such file or directory" but file is there
by fasoli
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |