my $eval; my %hash; # Find all three letter occurences, and combine them into one eval sta +tment. while (<>){ $eval = '$hash '; while (/(...)/g){ $eval .= "{'$1'}" } $eval .= "++;" eval ($eval); # You should probably do some error checking at this + point. } for (keys %hash){ hashValue ($hash{$_}); } # You got to love recursive functions ;) sub hashValue { my $hash = @_[0]; if (defined %$hash){ for (keys %$hash){ hashValue ($$hash{$_}); } } else { print $hash; # Or do whatever you like with the value } }
In reply to Re: varying length multi-dimensional hashes
by c-era
in thread varying length multi-dimensional hashes
by joe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |