Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: File that exists won't open

by ww (Archbishop)
on Mar 07, 2014 at 13:58 UTC ( #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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1077389]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2018-06-19 22:13 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (115 votes). Check out past polls.