The behaviour of a my, state, or our modified with a statement modifier conditional or loop construct (for example, my $x if ...) is undefined. The value of the my variable may be undef, any previously assigned value, or possibly anything else. Don't rely on it. Future versions of perl might do something different from the version of perl you try it out on. Here be dragons.
You can use the following:
if (my ($match) = $_ =~ /...(...).../) { $db_results->{$match} = delete $db_results->{$_} }
For $_, you can omit the $_ =~ part.
In reply to Re^3: Replace a hash key if it matches a regex
by choroba
in thread Replace a hash key if it matches a regex
by walkingthecow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |