in reply to Using $! and passing errors

you cannot use $!,
1) It is only meaningful, if you check it right after the failure. However you are tryinh to check it after a functuion returned, and at that moment, $! could be changed long time ago;
2) $! is usually set by system or library calls.

Replies are listed 'Best First'.
Re: Re: Using $! and passing errors
by pg (Canon) on Nov 15, 2002 at 21:14 UTC
    However this does NOT mean $! is readonly, you can change it. If you want it to be meaningful, set it to a number outside the range that being used by system. Again, there is a big chance that, at the time you check its value, it has been reset by the system, so you don't get what you want.