Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2018-09-24 11:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Eventually, "covfefe" will come to mean:













    Results (191 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!