http://www.perlmonks.org?node_id=489149


in reply to Updating A Hash Recursively

You need 3 levels of iteration to get 3 character keys. Something like this:
my %line=qw(A 1 B 1 C 1); my @tojoin = qw (W X Y Z); for my $l(sort keys %line){ for my $k(@tojoin){ $line{qq($l$k$_)}=1 for @tojoin } }; print qq($_\n) for sort keys %line ; -- Output --- A AWW AWX AWY ...snip... B BWW BWX ...snip... BZZ C CWW ...snip... CZZ

     "Man cannot live by bread alone...
         He'd better have some goat cheese and wine to go with it!"