in reply to Adding additional values to a hash of an hash ?

Here's a test script that illustrates one approach:

#!/usr/bin/perl -w use strict; use Data::Dumper; my %hash; print Dumper(\%hash); $hash{one}->{key1} = 'value1'; $hash{one}->{key2} = 'value2'; print Dumper(\%hash);

Note, I never actually assigned a value to $hash{one}. When I assigned a value to $hash{one}->{key1}, Perl automatically created the hashref for me before assigning 'value1' to the key 'key1'. This automatic creation of a data structure is called autovivification.

I like to use arrows to indicate dereferencing, but they are optional (and I think they're going away in Perl 6) so these two lines are equivalent:

$hash{one}->{key1} = 'value1'; $hash{one}{key1} = 'value1';