Just for support, the following behaves the same under ActiveState 5.8.9 and Strawberry 5.14.4:
c:\@Work\Perl>perl -wMstrict -le
"print qq{perl version $]};
;;
my %h = qw(foo ZOT);
;;
$_ = 'foo';
;;
print qq{before rx: '$_'};
my $rx = qr{ \A \s* (??{ print qq{in rx: '$_'}; $_; }) }xms;
;;
print qq{before match: '$_'};
print 'match' if $h{'foo'} =~ $rx;
print qq{after match; '$_'};
"
perl version 5.008009
before rx: 'foo'
before match: 'foo'
in rx: 'ZOT'
match
after match; 'foo'
And no, I've never encountered this behavior, either (but neither have I looked for it).
Give a man a fish: <%-{-{-{-<