in reply to Re: determine the variable causing the error: Use of uninitialized value
in thread determine the variable causing the error: Use of uninitialized value

... uninitialized value ... is a warning, not an error (unless it's escalated to FATAL-ity); no exception is thrown.


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^3: determine the variable causing the error: Use of uninitialized value
by marinersk (Priest) on Apr 14, 2017 at 04:42 UTC

    Thank you -- That was the closest thing I could come up with, so I should trust my instincts more.

    So --

    Since you didn't mention one, I presume there isn't an evalequivalent which does catch warnings?

      You could use

      { local $SIG{__WARN__} = sub { ... }; eval { ... }; }

      to trap the warning and do something special with it. However, I can't see that helping with identifying uninitialised values.

      There's example code in perlvar: %SIG.

      — Ken

      "...catch warnings?"

      With use warnings FATAL => qw(uninitialized); it works with eval as well as with Try::Tiny. As AnomalousMonk suggested.

      «The Crux of the Biscuit is the Apostrophe»

      Furthermore I consider that Donald Trump must be impeached as soon as possible