Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, Does perl store runtime errors in a special global variable or is there another way to capture the runtime error in a variable. For example, I know eval stores its error messages in $@. thanks a bunch, Michael

Replies are listed 'Best First'.
Re: perl special variables
by Tanktalus (Canon) on Mar 29, 2005 at 21:04 UTC

    I may be misinterpreting the question, but aren't runtime errors things that cause the whole program to die? So, either you need to catch them via eval (and thus use the $@ variable), or you may be able to catch them on the way out via %SIG, although I'm not sure that's a good idea...

Re: perl special variables
by brian_d_foy (Abbot) on Mar 30, 2005 at 04:15 UTC

    You might want to scan through perlvar which lists all of the Perl special variables. You'll probably be surprised how many things you can change with some special variable, and even if you don't need them now, you may remember that they exist later. (I also recommend the same scan of perlfunc at least once, just so you know what's there.)

    Personally, I keep a copy of The Perl Pocket Reference (okay, 4 copies, I don't know how I keep acquiring them) next to my desk. I like paper references. :)

    --
    brian d foy <brian@stonehenge.com>
Re: perl special variables
by Joost (Canon) on Mar 29, 2005 at 21:06 UTC