in reply to Re^2: how to dir a directory that have space
in thread how to dir a directory that have space
So if you need to pass such a string with doublequotes untouched, for example inside a sigle quote string you need to escape (with '\') all occourences of " you want to be passed unaltered, as in:dir "C:\Local Publish\images" #OK
As personal suggestion avoid to create and use paths with spaces, is a very stupid 'feature'.perl -e " $dir = '\"C:\Local Publish\images\"'; system qq(dir $dir )" + #OK
So you can safely do the same in a Perl program:dir "C:/Local Publish/images" #OK
If you need to interpolate some var inside such strings you need the concatenation operator (the dot '.'):perl -e " $dir = '\"C:/Local Publish/images\"'; system qq(dir $dir )" + #ok
You can use this post as explaination of quotes in Perl and the docs as base rference. Read also the usage hints on windows especially using Perl from command line.perl -e " $img = 'images';$dir = '\"C:/Local Publish/'.$img.'\"'; syst +em qq(dir $dir )"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: how to dir a directory that have space
by Anonymous Monk on Jan 16, 2015 at 09:21 UTC | |
by Discipulus (Canon) on Jan 16, 2015 at 09:31 UTC |