Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Updating A Hash Recursively

by NetWallah (Canon)
on Sep 05, 2005 at 06:11 UTC ( #489149=note: print w/replies, xml ) Need Help??


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!"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://489149]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2020-06-04 22:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (35 votes). Check out past polls.

    Notices?