system/backticks output not as expected
by Lars Oeschey other posts by this author
Oct 30 2009 6:38AM messages near this date
RE: Accessing Extended File Attributes - Word Document
|
RE: system/backticks output not as expected
Hi,
I have a problem getting the output of a system call. It's a simple
code:
my $return=`$command`;
print "$?\n";
print "result:$return\n";
(I am calling a command which actually doesn't exist, to check error
handling)
as result on the console I have:
Das System kann das angegebene Laufwerk nicht finden.
256
result:
The first error says it can't find the program. Actually I expected this
in $return.
compared to system():
my $return=system("$command");
print "$?\n";
print "result:$return\n";
Das System kann das angegebene Laufwerk nicht finden.
256
result:256
So obviously system() returns the error code. But why don't the
backticks return anything at all? Ideally I'd want all the output
catched to log, but still be able to react on errors...
Lars
_______________________________________________
ActivePerl mailing list
ActivePerl@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Lars Oeschey
Brian Raven
Serguei Trouchelle
Conor Lillis
|