in reply to Regexing a hash line thing
Although this leaves the quotes around both keys and values, which may or may not be desirable, and won't work for anything more complicated than simple constants. So as zigdon has mentioned a simple split should suffice.use Regexp::Common; my $re = qr/ ( \w+ | $RE{quoted} ) \s+ => \s+ ( \w+ | $RE{quoted} ) ,? /x; /$re/ and print "$1: $2\n" while <DATA>; __DATA__ key => 44, "key" => "fun. \"yes\" 'fun'", 'key' => 'yahoo\' "fun"'
_________
broquaint
|
|---|