http://www.perlmonks.org?node_id=1077389


in reply to File that exists won't open

Just for giggles ...and because I've seen peculiar but inconsistent problems when including a hyphen (minus-sign) or appending one in a variable name under AS 5.10 ... 5.16, I tried some variants on your Line 007 (using "perl 5, version 16, subversion 3 (v5.16.3) built for MSWin32-x86-multi-thread" and escaping the double quotes to keep the Win32 shell happy, since my Linux box is otherwise occupied):
C:\>perl -E "my $c; open(IN,"$c-assignments.dat") or die "Can't open i +nput: $!\n"; Can::t at -e line 1. C:\>perl -E "my $c; open(IN,\"$c-assignments.dat\") or die \"Can't ope +n input: $!\n\"" Can't open input: No such file or directory C:\>perl -E "my $c; say $c - assignments.dat;" 0dat C:\>perl -E "my $c; say $c-assignments.dat;" 0dat C:\>perl -E "my $c; say \"$c-assignments.dat\";" -assignments.dat

The modified double-quotes shouldn't (TBOMK) change the way Perl interprets the code; they just keep the shell from diddling with the intent. But, as you can see, this for-giggles code suggests that yours won't do what you intended.

Why strict is not squawking is another question: I can't explain why Perl should see "$c-assignments.dat" as a valid variable, when only "$c" has been declared but your report doesn't tell us that you say any such complaints.

Bottom line: is what you posted an exact cut'n'paste of the code giving you problems?

Come, let us reason together: Spirit of the Monastery