in reply to Re^2: Parsing Data Help!
in thread Parsing Data Help!
but I am sure there is a module doing it simpler.sub findcd { my $someref = shift; my $type = ref($someref); if( $type eq "" ) { # do nothing for non-references } elsif( $type eq "ARRAY" ) { foreach my $elem (@{$someref}) { findcd( $elem ); } } elsif ($type eq "HASH" ) { foreach my $elem (keys %{$someref}) { print "cd: $$someref{$elem}\n" if $elem eq "cd"; findcd( $$someref{$elem} ); } } else { warn "Cannot deal with $type.\n"; } } findcd( $p );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Parsing Data Help!
by Anonymous Monk on Mar 15, 2013 at 15:44 UTC |