Kursad has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to learn perl, I have this code:
This enters an infinite loop and the output is%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"; }
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...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Infinite loop with each
by Old_Gray_Bear (Bishop) on Jun 05, 2008 at 05:04 UTC | |
|
Re: Infinite loop with each
by ikegami (Patriarch) on Jun 05, 2008 at 04:18 UTC | |
by dragonchild (Archbishop) on Jun 05, 2008 at 13:32 UTC | |
|
Re: Infinite loop with each
by ysth (Canon) on Jun 05, 2008 at 03:26 UTC | |
by Kursad (Initiate) on Jun 05, 2008 at 03:39 UTC | |
by ysth (Canon) on Jun 05, 2008 at 04:39 UTC | |
by GrandFather (Saint) on Jun 05, 2008 at 04:42 UTC | |
by HelenCr (Monk) on Jun 01, 2012 at 10:36 UTC | |
|
Re: Infinite loop with each
by GrandFather (Saint) on Jun 05, 2008 at 04:11 UTC | |
|
Re: Infinite loop with each
by Gangabass (Vicar) on Jun 05, 2008 at 03:42 UTC | |
by Kursad (Initiate) on Jun 05, 2008 at 04:05 UTC | |
by Gangabass (Vicar) on Jun 05, 2008 at 04:52 UTC |