Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Can you explain the result?

by Anonymous Monk
on Dec 06, 2011 at 13:32 UTC ( #942020=note: print w/ replies, xml ) Need Help??


in reply to Re: Can you explain the result?
in thread Can you explain the result?

I know and has lower priority than &&,but it doesn't explain this issue.


Comment on Re^2: Can you explain the result?
Select or Download Code
Re^3: Can you explain the result?
by choroba (Abbot) on Dec 06, 2011 at 13:33 UTC
    It does. Try with print instead of return to see.
      Do you mean the priority of and is even lower than return???
        Indeed it is, if you want something evaluated put it in parenthesis to be sure
        return (1 and 0);
        returns 0 as you would expect.

        print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

        Indeed. and 'n or are good for control flow such as replacing simple error-handling ifs, while && 'n || are your standard Boolean logic operators.

        See perlop for the precedence table. not, and, or, and xor are all at the bottom of the table.

        --MidLifeXis

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (18)
As of 2014-08-22 17:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (161 votes), past polls