Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 }


Comment on Re: capture errors from eval
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2015-07-05 04:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls