in reply to Strange Regex Behavior

It seems match the last 'key => value' first, i try the below code serval times, but got the same output.

use strict; use warnings; use Data::Dumper; my $b = 'test 200'; my %hash = ( c => ( $b =~ /([a-z]+)/ ? $& : 0 ), b => ( $b =~ /(\d+)/ ? $` : 0 ), a => ( $b =~ /\s+/ ? $' : 0 ), ); print Dumper(\%hash);

Output:

$VAR1 = { 'c' => ' ', 'a' => '200', 'b' => 'test' };