Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Weird syntax question

by Anonymous Monk
on Aug 23, 2001 at 22:40 UTC ( [id://107453]=note: print w/replies, xml ) Need Help??


in reply to Weird syntax question

What you have in mind is a re-arrangement of:

   if ( $x ) { print 1; } else { print 0; }

What you are really getting is:

   if ( $x or print 0 ) { print 1; }

Thus when $x is false, 'print 0' is executed, and then, since the print() returns true, the if-then body is carried out.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-24 00:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found