$me = "dirtest2"; # Perl script to test variations on file/dir test argument quoting 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:\\users\\public\\Music"; $part2 = "Sample Music"; $dfull = "$part1\\$part2"; print "\nThese tests use a path consisting of concatenated substrings:\n"; print " part1 = '$part1'\n"; print " part2 = '$part2'\n"; print " dfull = '$dfull'\n"; print "\n"; $expl = "Part1, unquoted"; if ( -e $part1 ) { print "'-e $expl' is true\n"; } else { print "'-e $expl' is false\n"; } $expl = "Full path, unquoted"; if ( -e $full ) { print "'-e $expl' is true\n"; } else { print "'-e $expl' is false\n"; } $expl = "Part1 in single quotes"; if ( -e '$part1' ) { 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 = "Part1 in double quotes"; if ( -e "$part1" ) { 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"; }