|
Hi!
I have an array which contains associative maps. I pass this array to a function using "my @arr= @_". In debug mode, when I am over @arr I can see that in function this value is passed rightly because values are my maps. The problem starts when I try to extract the single maps in it. For esample I believed that doing my %map = $arr[0] I could obtain the map in zero position but it is not so. In debug mode I obtain a variable with undef value and name (HASH056E...). Then I cant't loop my map to extract keys and values....
Please help me.
Thanks very much.
Da
|
|
|
have u tried:
my %map = %$arr[0];
?
i think the values in @arr are basically just references to hashes, but not actually hashes.
|
|
|
ok yes with "my %map = %{$arr[0]};" it is ok
Thanks
|
|
|
my $name_of_hash = $arr[0];
my %map = %{$name_of_hash};
#its more readable this way.
|
|
|
|
|
|
|
// |