Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: capture errors from eval

by tinita (Parson)
on Sep 24, 2012 at 09:34 UTC ( #995330=note: print w/replies, xml ) Need Help??


in reply to capture errors from eval

I'd do it like this:
my $re = eval { qr/$x/ }; if ($@) { ... } else { $string =~ $re }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995330]
help
Chatterbox?
LanX and Bonny Tyler sings "total eclipse of the states"...
[runrig]: https://youtu.be/ HmLk2vSXXtk
[LanX]: ... Trump Around. ... 🎶

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2017-08-21 16:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Who is your favorite scientist and why?



























    Results (324 votes). Check out past polls.

    Notices?