in reply to Python -V command not returning any value
Try this, it works,
print "Hello World \n"; my $tmp = `python -V 2>&1`; print "Version: $tmp \n";
Note that you cannot simply open STDERR to be a dup of STDOUT in your Perl program and avoid calling the shell to do the redirection. This doesn't work:
This fails because the open() makes STDERR go to where STDOUT was going at the time of the open(). The backticks then make STDOUT go to a string, but don't change STDERR (which still goes to the old STDOUT).open(STDERR, ">&STDOUT"); $alloutput = `cmd args`; # stderr still escapes
|
|---|