SilverB1rd has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
I'm having trouble locating the cuase of an endless loop while I trasvers a complex data structure. The endless loop happens in the second foreach statment but after looking over the camel I have not found any hints as to what is wrong.
The wisdom of my fellow monks is much needed.
use strict; my $name = 'test'; my %test; push @{$test{"$name"}}, { name => 'me',age => 'here' }; push @{$test{"$name"}}, { name => 'meAgain',age => 'Nowhere' }; push @{$test{"two"}}, { name => 'you',age => 'there' }; push @{$test{"two"}}, { name => 'AndYou',age => 'AndThere' }; my ($s,$u,$n); foreach $s (keys %test) { foreach $u ( @{$test{$s}} ) { foreach $n (keys %{$test{$s}[$u]}) { print "$s $u $n: $test{$s}[$u]{$n} - \n"; } } }
------
PT - Perl Tanks %100 Perl programming game
The Price of Freedom is Eternal Vigilance
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Cause of an endless loop?
by tlm (Prior) on Jun 18, 2005 at 21:46 UTC | |
Re: Cause of an endless loop?
by davidrw (Prior) on Jun 18, 2005 at 22:15 UTC |
Back to
Seekers of Perl Wisdom