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

Re^3: Can you explain the result?

by choroba (Canon)
on Dec 06, 2011 at 13:33 UTC ( #942021=note: print w/ replies, xml ) Need Help??

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

It does. Try with print instead of return to see.

Comment on Re^3: Can you explain the result?
Replies are listed 'Best First'.
Re^4: Can you explain the result?
by Anonymous Monk on Dec 06, 2011 at 13:36 UTC
    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."

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


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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2015-11-28 23:43 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (746 votes), past polls