Jas wrote:
> 
> I am still new to working with Perl myself but I think I know the anwer
> to this one...
> 
> my $cmd = system('netstat -s')or die "Could not run command: $1";
> my $cmd = system('netstat -a | grep tcp')or die "Could not run command: $1";

If netstat executed successfully then it will return 0 (zero) otherwise
it will return a non-zero value if an error occurred.  system() returns
that value so $cmd will be a numerical value and if it is zero 'or' will
cause die() to execute which means that if netstat was successful the
program will end and if netstat failed the program will continue.  Also
you have $1 in the error message which is only relevant to regular
expressions.


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to