Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: weird begginer's problem...

by MidLifeXis (Monsignor)
on Sep 06, 2012 at 16:23 UTC ( #992135=note: print w/replies, xml ) Need Help??


in reply to weird begginer's problem...

A preference as well, although it may save you some trouble later:

foo() || die "bar"

vs

foo() or die "bar"

The || is of higher precedence than or. Using or (at least in the action or die pattern) can help avoid some sneaky precedence bugs.

Update: Added example below

perl -e 'print 1 - 1 || die "hello"'

vs

perl -e 'print 1 - 1 or die "hello"'

--MidLifeXis

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992135]
help
Chatterbox?
[LanX]: interpolation! like in a "string"
[Lady_Aleena]: LanX, I just never thought I would be explaining perl regex to others. It is usually others explaining why a regex isn't working to me.
[Discipulus]: congratulations shmem! (was my last upvote? ;=)

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2017-04-28 09:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (520 votes). Check out past polls.