in reply to Re^4: Execute command with spaces in perl
in thread Execute command with spaces in perl

That appears to have been fixed since 2011:

C:\usr\local\share\PassThru\perl>perl -Mwarnings -Mstrict -MConfig -le + "my $cmd = q|C:\Program Files\Mozilla Firefox\firefox.exe|; open my +$fh, '-|', $cmd, '--version' or die $!; m y $out = do { local $/; <$fh> }; close $fh or die $! ? $! : qq(\$?=$?) +; print $out; print $Config{myuname}" Mozilla Firefox 61.0.2 Win32 strawberry-perl 5.26.2.1 #1 Sun Apr 15 13:52:49 2018 x64

Trying to narrow it down a bit, using berrybrew to help me, it appears it was sometime between v5.20 and v5.26:

C:\usr\local\share\PassThru\perl>berrybrew use 5.10.1_32,5.16.3_64,5.2 +0.3_64,5.26.1_32 perl-5.10.1_32 ============== Microsoft Windows [Version 10.0.16299.611] (c) 2017 Microsoft Corporation. All rights reserved. <berrybrew use 5.10.1_32>: run "exit" leave this environment C:\usr\local\share\PassThru\perl>perl -Mwarnings -Mstrict -MConfig -le + "my $cmd = q|C:\Program Files\Mozilla Firefox\firefox.exe|; open my +$fh, '-|', $cmd, '--version' or die $!; m y $out = do { local $/; <$fh> }; close $fh or die $! ? $! : qq(\$?=$?) +; print $out; print $Config{myuname}" List form of pipe open not implemented at -e line 1. <berrybrew use 5.10.1_32>: run "exit" leave this environment C:\usr\local\share\PassThru\perl>exit Exiting <berrybrew use 5.10.1_32> perl-5.16.3_64 ============== Microsoft Windows [Version 10.0.16299.611] (c) 2017 Microsoft Corporation. All rights reserved. <berrybrew use 5.16.3_64>: run "exit" leave this environment C:\usr\local\share\PassThru\perl>perl -Mwarnings -Mstrict -MConfig -le + "my $cmd = q|C:\Program Files\Mozilla Firefox\firefox.exe|; open my +$fh, '-|', $cmd, '--version' or die $!; m y $out = do { local $/; <$fh> }; close $fh or die $! ? $! : qq(\$?=$?) +; print $out; print $Config{myuname}" List form of pipe open not implemented at -e line 1. <berrybrew use 5.16.3_64>: run "exit" leave this environment C:\usr\local\share\PassThru\perl>exit Exiting <berrybrew use 5.16.3_64> perl-5.20.3_64 ============== Microsoft Windows [Version 10.0.16299.611] (c) 2017 Microsoft Corporation. All rights reserved. <berrybrew use 5.20.3_64>: run "exit" leave this environment C:\usr\local\share\PassThru\perl>perl -Mwarnings -Mstrict -MConfig -le + "my $cmd = q|C:\Program Files\Mozilla Firefox\firefox.exe|; open my +$fh, '-|', $cmd, '--version' or die $!; m y $out = do { local $/; <$fh> }; close $fh or die $! ? $! : qq(\$?=$?) +; print $out; print $Config{myuname}" List form of pipe open not implemented at -e line 1. <berrybrew use 5.20.3_64>: run "exit" leave this environment C:\usr\local\share\PassThru\perl>exit Exiting <berrybrew use 5.20.3_64> perl-5.26.1_32 ============== Microsoft Windows [Version 10.0.16299.611] (c) 2017 Microsoft Corporation. All rights reserved. <berrybrew use 5.26.1_32>: run "exit" leave this environment C:\usr\local\share\PassThru\perl>perl -Mwarnings -Mstrict -MConfig -le + "my $cmd = q|C:\Program Files\Mozilla Firefox\firefox.exe|; open my +$fh, '-|', $cmd, '--version' or die $!; m y $out = do { local $/; <$fh> }; close $fh or die $! ? $! : qq(\$?=$?) +; print $out; print $Config{myuname}" Mozilla Firefox 61.0.2 Win32 strawberry-perl-no64 5.26.1.1 #1 Sun Sep 24 11:38:56 2017 i386 <berrybrew use 5.26.1_32>: run "exit" leave this environment C:\usr\local\share\PassThru\perl>exit Exiting <berrybrew use 5.26.1_32>

Replies are listed 'Best First'.
Re^6: Execute command with spaces in perl
by Corion (Patriarch) on Aug 27, 2018 at 16:07 UTC

    Ahahhaa! My error was in just trying it from the command line instead of piping the output of firefox.exe to make it output something:

    Without the pipe, it outputs nothing:

    >"c:\Program Files (x86)\Mozilla Firefox\firefox.exe" --version

    With the pipe, it outputs the version information, as it should:

    >"c:\Program Files (x86)\Mozilla Firefox\firefox.exe" --version | more Mozilla Firefox 61.0.2