it just seems odd that Perl's open doesn't just ignore the surrounding quotes

It would seem odd (and a bug) to me if Perl's open did just ignore the quote characters in the string I pass as the filename. If I send a string to that third argument of open, that is the exact text I want as the filename. If Perl started ignoring my characters without my permission, I'd get annoyed.

And in Linux environments, quotes are perfectly valid characters inside filenames, so if I wanted my file named `"QuotedFilename"` in Linux, and Perl silently stripped those characters for me, I'd really be annoyed.

I use the quoted filename in the scalar variable other places for other things

In that case, I would store the filename variable as the actual name of the file, and then properly quote it for whatever environment you're sending that filename to. The quoting is part of the environment's requirement, not part of the filename. (By "environment", I don't mean %ENV; I mean it in the sense of "All the elements that affect a system or its inputs and outputs." -- wiktionary:environment)


In reply to Re^3: Filename Surrounded by Quotes in a Scalar Variable Causes Open to Fail by pryrt
in thread Filename Surrounded by Quotes in a Scalar Variable Causes Open to Fail by roho

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.