hashes are not randomly ordered lists, they are lists that don't have any guaranteed ordered, but they should always be the same order on the same computer. So that bug report appears to be erroneous because the reporter did not seem to understand that hashes are not randomly ordered.
If you need to use a hash, you can store the keys in an array and use List::Util and the shuffle function to randomly order the array with the hash keys. Then loop over the array instead of the hash. An example:
use List::Util qw/shuffle/;
my @keys = (1..26);
my @values = ('a'..'z');
my %hash;
@hash{@keys}=@values;
@keys = shuffle(@keys);
for(@keys){
print "$hash{$_}\n";
}
Last edited by KevinADC; Jul 31st, 2009 at 3:52 pm.
Reputation Points: 246
Solved Threads: 67
Practically a Posting Shark
Offline 898 posts
since Mar 2006