Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Foreach hash of array

by cdarke (Prior)
on Aug 05, 2008 at 15:36 UTC ( #702398=note: print w/replies, xml ) Need Help??


in reply to Foreach hash of array

For what its worth, this works:
sub printit { my $ref = shift; foreach my $key (keys %$ref) { print "$key: "; if (ref $ref->{$key} eq 'ARRAY') { if (ref $ref->{$key}[0]) { printit($ref->{$key}[0]) } else { print "$ref->{$key}[0]\n" } } elsif (ref $ref->{$key} eq 'HASH') { printit ($ref->{$key}) } else { print "$ref->{$key}\n" } } } printit ($xml);
But I don't know if it gives what you want, 'cause I don't know what you want.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://702398]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2018-07-19 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (421 votes). Check out past polls.

    Notices?