in reply to $! vs the @_ passed to your SIG(DIEWARN) handler
then you will get:$SIG{__DIE__} = sub { print "Died with message '$_[0]'\n"; }; open(NOFILE, '/no/file/here') or die "Ooops: $!";
Died with message 'Ooops: No such file or directory at /home/stephen/t +est.pl line 2. '
Make sure you don't forget the double underscores before and after WARN and DIE, or you won't catch anything at all.
See perlman:perlvar for more information on %SIG. See perlfunc:warn and perlfunc:die for trapping warn and die.
stephen
|
|---|