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 end
my $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.
@ARGV = ("C:/Program Files/Perl Express/sample.txt", "some hash"); # I + dunno the path value in advance. This is just an example system("C:/Perl/bin/perl.exe /path/to/the/script @ARGV");
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,In reply to How to escape white space in command line arguments by GoForIt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |