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

In reply to Re: File that exists won't open by ww
in thread File that exists won't open by cormanaz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.