Re: values of hash of hash



My nummeric key is example only. My real application has keys that mix of text and number.
My problem is, I have to compare data from two projects and find out duplicated data. Two projects presented as two hash. If first level key is different (using exist function), put the whole data attached to it in an array. Currently, I have to access level 2, level 3 keys before getting it's real value. It is not advanced computing. So I want to access all values without using keys. Using "values %hash" just gives me next level hash.


Matija Papec wrote:
On Thu, 01 Sep 2005 11:27:32 +0200, ngoc <ngoc@xxxxxxxxx> wrote:


I have
$hash{1}{2}{3} = 7;
$hash{1}{4}{5} = 6;
I want to get 7 and 6 without using three for loop and keys function
How can I do it?


use Data::Dumper;
my $s = Dumper \%hash;
my @numbers = $s =~ /([76])/g;

:)

btw, is there a reason for using a hash? perhaps you could be better
with arrays (all you keys are numeric).


.