my @sorted = sort { $hash{SIZE}[$a] <=> $hash{SIZE}[$b] } 0..$#{$hash{SIZE}}; $hash{$_} = [ @{$hash{$_}}[@sorted] ] for keys %hash;