The Opposing View
Using '/' for paths in Perl gives almost no problems on DOS and Windows machines, because the underlying OS accepts / as a synonym for \ (most of the time).
But is that true for all OS's and platforms? Like someone already said, it doesn't work on the Mac. The Perl interpreter itself might change / to : before calling the OS, but what about real /'s in file names, like "notes from 4/27/99"? What about :'s in the file name?
A solid program should always use the native path separator and do so uniformly and consistantly.
If that's not handy, Perl 6 will reportetly offer uniform URL support, so you can use file:// notation on files on any OS, with %xx for funny chars and / for seperators. There might also be a module that deals with paths as a collection of nodes and abstracts the actual syntax.
And just because the OS takes / as an alias, or Perl translates for you behind the scenes, what happens to individual programs you invoke? In the COMMAND.COM shell, the / will parse wrong, as we saw on a recient posting. A program might get confused if / and \ are mixed in the same string. Who knows? you're at the mercy of whoever wrote that program!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||