$! is the oserror.
$@ contains the exceptions thrown by eval.

Eg:
----

use strict;
my $out = get_list();
if($@) {
        print "Could not get the list: $@";
}

....
....

sub get_list {
        # If we die return the error set in [EMAIL PROTECTED]
        eval {
                # If we are unable to get the list, die with the
                # error produced by my os.
                my $out = qx("ls -l") or die "Error getting list: $!";
                return $out;
        }
}

----

perldoc perlvar
perldoc -f eval

-Sharad

-----Original Message-----
From: jdavis [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 08, 2003 1:39 PM
To: perl
Subject: $! and $@


Hello,
  I think these catch errors somehow...

  $! and $@

  could someone explain this.

thanks,
-- 
jdavis <[EMAIL PROTECTED]>


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


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

Reply via email to