On Tue, Jan 27, 2004 at 06:41:45PM -0000, Flash Sheridan wrote: > ----------------------------------------------------------------- > The following code incorrectly prints -1 under Perl v5.8.2 build 808, but > correctly prints 0 for 5.6.1 build 631, with CygWin true. > CygWin's true is working correctly, as verified by echo %ERRORLEVEL%; > I originally noticed the problem with > an internal tool. More complicated code relying on the expected behavior > has been working for over a year. > Because of ActiveState's warning about dual installations, I haven't > yet tried both versions of Perl on the same machine; > the bug is on a new Windows XP box. > > > use strict; use warnings; use diagnostics; use English; use 5.6.0; > my $theSysText = qx("true 2>&1"); > print "\nCHILD_ERROR: $CHILD_ERROR\n"; First, a disclaimer - I don't use Windows, so some of the following is speculative. However, the '2>&1' syntax is specific to UNIX (Bourne-like) shells, and is unlikely to work under Windows. A return code of -1 usually means that Perl was unable to execute the command. For example on my Linux system: $ ./perl -e '$a=`/xxx`; print "\$?=$? \$a=[$a] \$!=[$!]\n"' $?=-1 $a=[] $!=[No such file or directory] Try printing out $! to see what the error is, then see if the problem goes away by removing the 2>&1. Dave. -- Monto Blanco... scorchio!Thread Previous | Thread Next