in reply to odd =>behavior

Erm, is it just me or do you seem to be confuzzling the fat comma => with the numeric lessgreater-than-or-equals operator >=? You're basically asking if a LIST in boolean context is true (which your list is, so you get all the elements).

Update: Lesser, greater. Something about alligators. Meh. :)

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: odd =>behavior
by tcf03 (Deacon) on Dec 04, 2007 at 17:29 UTC
    I think I have in fact done that. In my original code, I had fat fingered => ( in lieu of >= ) I had a few moments and was playing with => vs >= on the command line. My first example, using => and >=, outputs 12. So based on that behavior, I would have expected the same to happen in my code.

    Ted
    --
    "That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
      --Ralph Waldo Emerson

      In your first example you have $num which is greater-than-or-equal to 1, so that prints the 1; you also have (in effect) print 2 if 2 which again is always true so it's always going to print.

      When you change your conditional in the later code to print unless $count => 8 you effectively have print unless 8, which will always be true hence you get all elements.

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.