in reply to Parsing command line

I noticed a similar issue when using Getopt::Long. Regardless of whether it's a problem with the shell or not, quoted strings don't get through intact. I wrote a simple function that takes a command line and splits it into @ARGV. You could probably modify it to work on the already-split @ARGV directly, or just do this first:
$cmdline = join(' ',@ARGV); parsetoargv($cmdline);
Here's the function:
sub parsetoargv { my ($cmdline, $idx) = (shift, 0); @ARGV = (); { $cmdline =~ m{ \G\ }gcx && do {redo}; # Eat a space $cmdline =~ m{ \G" }gcx && do { # Start a quot +ed-string $cmdline =~ m{ \G(.*?)(?<!\\)" }gcx && do { # Match up t +o the next unescaped quote ($ARGV[$idx++] = $1) =~ s/\\"/"/g; # And put +it in ARGV, removing escaping slashes }; redo }; $cmdline =~ m{ \G(.*?)(?="|\ |$) }gcx && do { # Match up to +just before the next quote, space, or end-of-line $ARGV[$idx++] = $1 if ($1 ne ''); redo # And put it +in ARGV if it isn't empty }; } }
Now your @ARGV is ready for GetOptions.