my @indices = sort {$hash{SIZE}[$a] <=> $hash{SIZE}[$b]} 0..$#{$hash{SIZE}}; foreach my $key (keys %hash) { @{$hash{$key}} = @{$hash{$key}}[@indices]; # Slice }