in reply to regular expression help

Unless there's a really compelling reason to do this in a single regex I wouldn't.

my %results; for my $tok ( split /\s+/, $input ) { $results{ $1 } = $2 if $tok =~ /^ (.) = (\d+) $/x; } for my $k ( qw( a b c ) ) { print "$k is ", exists $results{ $k } ? $results{ $k } : 'missing', +"\n"; }

Update: Just to clarify, eschewing explicit iteration to get away with just a single regex doesn't really gain you anything and (arguably) makes your code harder to read/maintain/understand ("OK, it's a for loop" vs "ZOMGWTFBBQ is this ?<a . . . grah, let me open perlre and try and remember")

The cake is a lie.
The cake is a lie.
The cake is a lie.