Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Should I fear eval? (want to do two things on the left side of an if/unless)

by Corion (Patriarch)
on Aug 10, 2006 at 12:17 UTC ( [id://566599]=note: print w/replies, xml ) Need Help??


in reply to Should I fear eval? (want to do two things on the left side of an if/unless)

And should I fear trying to do more than one "semicolon-separated thing" on the left side of an if/unless statement?

Yes :-). I'd use do{...} over eval{...} because do doesn't have the nasty habit of eating fatal errors unless I explicitly check for them. I'd still reverse the logic and put the consequent to the right side:

perl -e 'my $type="blee"; if ($type ne "newer" and $type ne "older") { + print "bad type\n"; print "blee\n"}'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-19 02:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found