|Just another Perl shrine|
How to escape white space in command line argumentsby GoForIt (Novice)
|on Apr 13, 2010 at 05:58 UTC||Need Help??|
GoForIt has asked for the
wisdom of the Perl Monks concerning the following question:
I'm trying to call a Perl script from another passing few arguments. One of my arguments has a path variable which has white spaces embedded in it. I know how to escape the white space when I know the value of the variable in advance. But how do I escape the white spaces in a scalar variable that's being passed as an argument to a script called inside another script.
For instance, we could escape the white space and read $path as one whole string till the endmy $path = "C:/\"Program Files\"/\"Perl Express\"/example.txt;
Now, I'm trying to pass one such $path variable and a hash as arguments to a script.
When I try to print this ARGV in the other script, it reads C:/Program and Files/Perl as first and second arguments.
Is there a way that I could escape such white spaces?Thanks,