in reply to Accesing hash of unknown dimension
sub trav_hash { my $ref = shift; my $type = ref $ref; if( $type eq 'HASH' ) { trav_hash( $ref->{$_} ) for keys %$ref; } elsif ( $type eq 'ARRAY' ) { handle_array( $ref ); } else { die "something weird is in our structure!"; } } sub handle_array { my $arrayref = shift; # do whatever we want with the array here.... } trav_hash( \%data );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Accesing hash of unknown dimension
by Otogi (Beadle) on Mar 20, 2006 at 22:28 UTC |