in reply to Re^2: Replace a hash key if it matches a regex
in thread Replace a hash key if it matches a regex

Are you saying ... is bad?

Yes — or at least potentially very weird and certainly very easily avoided. I'm afraid I don't have time ATM to locate a good explanatory link. (Update: Thanks, choroba, for the link)

The only alternative ... which I know ...

Sorry, I added some examples of alternatives after my original reply without marking them as update material. BTW, another alternative (assuming you're in a loop):
    next unless $_ =~ /(whatever)/;
    my $foo = $1;
    ...