in reply to importing all the values stored in an HoH into an array
Updated: Added the omitted { words } term in the keys expression.
Update2: Added omitted paren as noted by johngg.
What you appear to be asking for is
my @wordsList; for my $word ( keys %{ $hash{ $w1 }{ $w2 }{ words } } ) { push @wordsList, ( $key ) x $hash{ $w1 }{ $w2 }{ words }{ $key }; } print @wordsList[ rand( @wordsList ) ];
There are probably bits of that you do not understand, but rather than my trying to guess which they are, it's easier if you ask. In this thread rather than starting a new one.
Note: I've omitted the -> between the terms of the hash references as they are optional and I personal don't think thay add clarity, but your way is fine also.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: importing all the values stored in an HoH into an array
by johngg (Canon) on Oct 31, 2006 at 12:12 UTC | |
|
Re^2: importing all the values stored in an HoH into an array
by chinamox (Scribe) on Oct 31, 2006 at 13:37 UTC | |
by johngg (Canon) on Oct 31, 2006 at 13:48 UTC | |
by chinamox (Scribe) on Oct 31, 2006 at 14:02 UTC | |
by davorg (Chancellor) on Oct 31, 2006 at 13:46 UTC |