Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^3: Is it a list or a flip-flop?

by Transient (Hermit)
on Aug 18, 2005 at 19:21 UTC ( #484943=note: print w/replies, xml ) Need Help??

in reply to Re^2: Is it a list or a flip-flop?
in thread Is it a list or a flip-flop?

From perlop:

The value returned is either the empty string for false, or a sequence number (beginning with 1) for true. The sequence number is reset for each range encountered. The final sequence number in a range has the string "E0" appended to it, which doesn't affect its numeric value, but gives you something to search for if you want to exclude the endpoint. You can exclude the beginning point by waiting for the sequence number to be greater than 1.

The range operator has always stumped me a bit, so I can't say much more than what it says above

Update: I suppose it is working like this (in the case of setting $. to 1) - please correct me if I am wrong:

Since 1 is a constant, and so is $., it is evaluated as TRUE.
Since the LHS is true, the RHS is evaluated immediately.
Since the RHS is NOT a constant, it is not compared to $., but is returned as true because it is not false (i.e. 9 is not 0, "" or undef).
The range operation is completed.
Because it is a single iteration only, the sequence number is 1, and is appended with "E0"

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2020-07-03 20:12 GMT
Find Nodes?
    Voting Booth?

    No recent polls found