Use the list version of system, which is safer anyway:
my @cmd = ($ENV{COMSPEC}, "/c", "start", "soffice.exe", $file);
system(@cmd) == 0
or die "Couldn't launch @cmd: $! / $?";
I'm not sure when the backward incompatible change was introduced.
sub{system "start soffice \"$file\""})
As mentioned previously, the new style of system command removes this ambiguity and will make for a more portable program.
"start soffice \Q$file\E";to
"start soffice \"$file\"";that way anything weird in the string is escaped, including " chars that may be in it... of course, the list version of system is safer.
Which will not work for Win32 filenames, as a file named c\:\\autoexec\.bat does not exist.
Also, the quoting rule of double quotes (") is different for cmd.exe too - "" gets converted to ", """ gets converted to "" and so on. I think. In any case, quotemeta is not what you want when quoting strings for cmd.exe or command.com.
perlmonks.org content © perlmonks.org and arunmep, astroboy, bart, Corion, dwildesnl, inman, suaveant
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03