in reply to Re: capturing error messages from backticks or system
in thread capturing error messages from backticks or system

Your test code isn't conclusive. Since you don't have a clear ending delimiter in your print statement, we can't tell whether the "An attempt..." string is part of $results or not.

Fixing that:

#!/usr/bin/perl -w use strict; my $results = `net use f: \\\\SERVER\\c\$ 2>&1`; print "results contains ($results)\n";
gives me this:
results contains (System error 67 has occurred. The network name cannot be found. )
on Win2K. So the error message is going to STDERR, even in Win2K.

For capturing STDERR, IPC::Open2 and IPC::Open3 are often good alternatives.

        - tye (but my friends call me "Tye")