bigtiny has asked for the wisdom of the Perl Monks concerning the following question:
If I uncomment the Dumper line, I get the expected data structure and data. If I put a print statement after the first foreach and print $player, I get the data I expect, however, I cannot get any of the data from the inner foreach loops to print. I'm pretty sure I just haven't figure out how to properly de-reference the keys in the inner loops, but I can't seem to figure out how to do this.... Oh, and if I put these loops up in main, everything works fine..... Any help? Thanks, bigtinysub GEN_HTML { + # generate HTML for form $mp3hash = shift; + # hash - parsed xml itunes data #print Dumper(\%{$mp3hash}); foreach $player (sort keys %{$mp3hash}) { foreach $collection (sort keys %{$mp3hash{$player}}) { print "DEBUG: the player is [$player] the collection is [$collection]\ +n"; foreach $thetrack ( sort keys %{$mp3hash{$player}{$collect +ion}}) { foreach $bute ( sort keys %{$mp3hash{$player}{$collect +ion}{$track_name}}) { print "$player - $collection - $thetrack - $mp3has +h{$player}{$collection}{$track_name}{$bute}\n"; } } } } return; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Cannot dereference hash in subroutine....
by davorg (Chancellor) on Jul 18, 2005 at 15:10 UTC | |
by bigtiny (Acolyte) on Jul 18, 2005 at 15:17 UTC | |
by davorg (Chancellor) on Jul 18, 2005 at 15:19 UTC | |
by bigtiny (Acolyte) on Jul 18, 2005 at 15:24 UTC | |
by davorg (Chancellor) on Jul 18, 2005 at 15:32 UTC | |
|
Re: Cannot dereference hash in subroutine....
by ikegami (Patriarch) on Jul 18, 2005 at 15:33 UTC | |
|
Re: Cannot dereference hash in subroutine....
by artist (Parson) on Jul 18, 2005 at 15:16 UTC | |
|
Re: Cannot dereference hash in subroutine....
by ysth (Canon) on Jul 19, 2005 at 06:35 UTC |