I then tried the File::Spec module. It helps.

$me = "dirtest3"; # Perl script to test variations on file/dir test argument quoting use File::Spec; print "All of the following conditions are true on my system.\n"; print "The issue is to see which tests work.\n"; print "The final path includes a directory name containing a space.\n" +; print "\n"; $part1 = "C:"; $part2 = "users"; $part3 = "public"; $part4 = "Music"; $part5 = "Sample Music"; $full = File::Spec->catfile( $part1, $part2, $part3, $part4, $part5 ); print "\nThese tests use a path consisting of concatenated substrings: +\n"; print " full = '$full'\n"; print "\n"; $expl = "Full path, unquoted"; if ( -e $full ) { print "'-e $expl' is true\n"; } else { print "'-e $expl' is false\n" +; } $expl = "Full path in single quotes"; if ( -e '$full' ) { print "'-e $expl' is true\n"; } else { print "'-e $expl' is false\n" +; } $expl = "Full path in double quotes"; if ( -e "$full" ) { print "'-e $expl' is true\n"; } else { print "'-e $expl' is false\n" +; }
Again, I was a bit surprised at the second case. But I can use one of the other two cases.
All of the following conditions are true on my system. The issue is to see which tests work. The final path includes a directory name containing a space. These tests use a path consisting of concatenated substrings: full = 'C:\users\public\Music\Sample Music' '-e Full path, unquoted' is true '-e Full path in single quotes' is false '-e Full path in double quotes' is true


In reply to Re: Win file/dir names w/spaces by LloydRice
in thread Win file/dir names w/spaces by LloydRice

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.