Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: capture errors from eval

by tinita (Parson)
on Sep 24, 2012 at 09:34 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://995330]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-19 03:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found