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

Re^2: odd =>behavior

by tcf03 (Deacon)
on Dec 04, 2007 at 17:29 UTC ( [id://654873] : note . print w/replies, xml ) Need Help??

in reply to Re: odd =>behavior
in thread odd =>behavior

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.

"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

Replies are listed 'Best First'.
Re^3: odd =>behavior
by Fletch (Bishop) on Dec 04, 2007 at 17:36 UTC

    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.