Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: odd =>behavior

by tcf03 (Deacon)
on Dec 04, 2007 at 17:29 UTC ( #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.

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

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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2022-05-18 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (71 votes). Check out past polls.

    Notices?