Ok. Excellent point!

You point out what was probably the cause of my vaguely remembered problem:
"However, Windows commands typically use forward slash for command line argument options".
If forward slash means "option" then the command will "barf" with a forward slashed file path because it thinks that part of the file path is an option! That explains my error case!

I think we are in 100% agreement about file paths within Perl. Perl itself will always get forward slashed file names. Always use forward slash for file paths within Perl programs.

There is an exception if you want to launch a Windows system command. That may barf due to conflicts between an option switch vs a file path.

If you need to do a translation for that reason, I would put a comment in the code as to why the "/" is being translated to "\".
I stand by my recommendation not to translate formats unless you need to.

Your suggestion about tr is also to be commended. For a one 2 one translation, nothing beats tr for performance.


In reply to Re^4: What is the meaning of this line in Perl on linux? by Marshall
in thread What is the meaning of this line in Perl on linux? by Anonymous Monk

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.