Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: while ()

by Neutron Jack (Pilgrim)
on Jun 08, 2005 at 02:13 UTC ( [id://464528]=note: print w/replies, xml ) Need Help??


in reply to Re: while ()
in thread while ()

I don't believe that while(()) is an example of no expression. Rather, while(()) evaluates the condition (), a list of no elements. A list evaluated in scalar conext yields the last element, according to man perldata:
If you evaluate an array in scalar context, it returns the length of the array. (Note that this is not true of lists, which return the last value, like the C comma operator, nor of built-in functions, which return whatever they feel like returning.)
What's the "last value" of an empty list? Experiments indicate that it's undef, a false value, so the while-loop doesn't loop.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-25 22:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found