Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: File that exists won't open

by ww (Archbishop)
on Mar 07, 2014 at 13:58 UTC ( [id://1077389]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1077389]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-24 20:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found