From: [EMAIL PROTECTED]
> I want to get the error message from a system call as a text string
> and not a numeric code.  The error I see on the screen is:
> 
> cp: cannot create /tmp/dev/fin/test/test.inf: Permission denied
> 
> but when I check $! for an error string, it is blank.  $?  does
> contain an error code, but I'm not sure how I would translate it to a
> text string.   I also tried saving the output to a variable, but it
> doesn't contain the error message:
> 
> my $out = `$cmd`;

That's because this way you are only capturing the $cmd's STDOUT, not 
its STDERR.

You have to do this:

my $out = `$cmd 2>&1`;
        # tested under Win2k, you may need to use `$cmd 2>1` under Unix
        # I don't know.

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to