Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: eval '...'; die "err: $!"

by haukex (Bishop)
on Nov 09, 2021 at 18:39 UTC ( #11138641=note: print w/replies, xml ) Need Help??

in reply to eval '...'; die "err: $!"

The correct error variable to check after an eval is $@, not $! - the latter is actually empty in this particular case, but could potentially contain an error caused by a previous operation, leading to misleading results (try perl -Mstrict -we 'chdir("/foobarquz"); eval q(x=3) or die $!'). Also note perl -Mstrict -we 'eval q(x=3); die' has the same behavior as your second example, the reason is documented in die:

If LIST was empty or made an empty string, and $@ already contains an exception value (typically from a previous eval), then that value is reused after appending "\t...propagated".

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11138641]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2022-01-25 17:05 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (67 votes). Check out past polls.