for my $k (keys %hash) { my $v = delete $hash{$k}; my $t = transform($k); $hash{$t} = $v; }