This issue applies to Perl v5.24.0 on Windows 10
Except in the simplest cases. It is always a problem of passing commands and parameter lists between programs. Considering the effects of spaces and shell metacharacters, it is possible that the data remains intact at several levels of calls, may include a mess of screens and quotes
The panacea has always used the multiparameter form of system (which also tries to avoid invoking the shell as an intermediary), so that each parameter is reliably separated without the use of quotation marks
Call type
system("dir \"C:\\Program Files\\\"")
much simpler on an eye written like this:
system('dir', 'C:\Program Files\\')
However, I see no way to pass values โโcontaining enclosed quotes
If I write a test program
show.pl
use Data::Dump; dd \@ARGV;
and then call
system('show', 'xxx')
the conclusion that I get is what I expect
["xxx"]
However, suppose I want to pass the string "xxx" . If i try
system('show', '"xxx"')
then the quotation marks are lost at some point along the way, and the result is identical to the previous example
How to make a system call so that the output is ["\"xxx\""] ?
I tried all kinds of shoots, but the solution evades me
perl quotes exec
Borodin
source share