Hey perl lovers,

I'm trying to learn perl, I have this code:

%some_hash = ("foo", 35, "bar", 12.4, 2.5, "hello", "wilma", 1.72e30, +"betty", "bye\n"); while ( ($key, $value) = each %some_hash ) { print("number". $s++); print "$key => $value\n"; }
This enters an infinite loop and the output is
number0betty => bye number1betty => bye number2betty => bye number3betty => bye number4betty => bye . . .

Am I missing something here? I was expecting the loop to print out every element in the hash, but it doesn't. Any help appreciated.

I just discovered that it happens in my debugger only. I have an ubuntu installation with perl, eclipse and epic plugings. I have the padwalker installed. When I step in to the loop, it results in infinite loop. When directly run, it works fine as expected.

I have come up with so many problems, i'll almost give up on perl. This is really frustrating. I spent a week setting up the box and getting perl running with the debugger, now this...


In reply to Infinite loop with each by Kursad

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.