#!/usr/bin/perl use strict; use warnings; use 5.010; my $keys=[0..100]; my %hash1=hash($keys); my %hash2=hash($keys); print @{[values %hash1]} ~~ @{[values %hash2]}?'OK':'FAIL',"\n"; print @{[map{$hash1{$_}}sort(keys(%hash1))]} ~~ @{[map{$hash2{$_}}sort(keys(%hash2))]}?'OK':'FAIL',"\n"; sub hash { my $ref=shift; for ( reverse(0..$#$ref) ) { my $pos=int(rand(@$ref)); @$ref[$pos,$_]=@$ref[$_,$pos]; } my %l; map{$l{$_}= sprintf('%02u',ord($_))}@$ref; return %l; }