in reply to Get random element from HoA
Maybe it's me, but your question is a bit confusing. Are you saying that $some_number would be the hash key that you want to get a random element from? As in, given $some_number = 20 you want to randomly get either "george" or "jane" or "elroy"?
You can certainly index into your HoA without line 6.
my $foo = $hoa{20}[1]; # assigns "jane" to $foo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Get random element from HoA
by Anonymous Monk on Dec 27, 2007 at 18:01 UTC |