It might be a little more obvious like this:
$b = 'test 100'; %hash = ( a => ($b =~ /(\d+)/ ? $1 : 0), b => ($b =~ /(\w+)/ ? 1 : 0), ); print "$hash{a}\n";
which prints
test
So, it did the second pattern match first, and interpreted $1 to be the result of that pattern match. It's the same sort of ambiguity that is found in, say, ($i++)+$i.
In reply to Re: Strange Regex Behavior
by quester
in thread Strange Regex Behavior
by Manchego
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |