Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: capture errors from eval

by ikegami (Pope)
on Sep 24, 2012 at 01:13 UTC ( #995278=note: print w/replies, xml ) Need Help??


in reply to capture errors from eval

for example, expression= '/HOST=.*(' will yield a fatal die error..

Not so.

use strict; use warnings; my $w = '$expdata =~ /HOST=.*(;'; eval $w;

eval catches fatals errors and places the message in $@.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995278]
help
Chatterbox?
[karlgoethebier]: no saturday night special?
[karlgoethebier]: AKA bla, bla
LanX night fever ... ha ha ha ha staying alive ...
[karlgoethebier]: No sack of rice fell over in China?
[karlgoethebier]: PM is going down...
[LanX]: ♪..♫ Don't cry for me Mandarina .......♩..♬
[karlgoethebier]: ...pasta bolded too soft in Eately?
[karlgoethebier]: BOILED!

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2017-10-21 15:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (270 votes). Check out past polls.

    Notices?