how to add double quote to a string in Perl
my code looks following:
$id = "PROD121213123";
I am passing this to a function and adding this to it
"\"$wi_id\""
where $wi_id looks like my $wi_id = $_
After "\"$wi_id\""
the value looks like "PROD121213123" which I checked in Eclipse debugg开发者_StackOverflow中文版er (using EPIC)
I am calling curl.exe from Perl and it looks like this "" is omitted during execution. How can I have "" to the string and still execute using CURL?
It sounds like you're doing the equivalent of
my $id = "\"PROD121213123\""; # String <<"PROD121213123">>
system "curl.exe ... $id ..."; # curl sees <<PROD121213123>>
It's because the quotes have special meaning to the "shell". Command line parsing is a bit of a mess in Windows (nothing to do with Perl), so you might not be able to even pass double-quotes to curl
. I'd try using the multiple arg version of system
.
You're trying to pass a quotes string to a command which is called though a shell. To accomplice that, you'll need to escape the quotes to hide them for the shell:
my $id = q(\"PRD121212\");
system qq(curl.exe ... $id ...);
HTH, Paul
精彩评论