in reply to Backtick execution with spaces in filename

Quote your arguments, eg:
perl -le "$f = qx/cat 'Some File.txt'/; print $f"

<update>
Oops... strange mixture of Windows outer quoting and UNIX inner quotings and commands - thanks cdarke ;-)

perl -le "$f = qx/type \"Some File.txt\"/; print $f"
I rarely use Windows...;-)
</update>

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^2: Backtick execution with spaces in filename (was: "Backtick execution with spaces in filename")
by Anonymous Monk on Oct 09, 2006 at 08:13 UTC
    Sorry, but that won't work on Windows because the quoting on cmd.exe is picky compared to a UNIX shell. The following works:
    perl -le "$f = qx/type \"this is a name.pl\"/;print $f"
      Sorry, I did not intend to be Anonymous above, my browser lost my login for some reason.