in reply to Re: Puzzling syntax error
in thread Puzzling syntax error
As does the semi-colon trick
my %hash = map {; "$_" => 1 } qw(a b c);
Update:
I thought I'd better explain this idiom since Lawliet /msg'ed me about it.
Braces in perl are used for hashrefs and for blocks and sometimes perl has to "guess" at the intended meaning. Sometimes (as in this case), perl gets it wrong. The addition of a semicolon convinces perl it's a block, not a hashref.
At least that's how I understand it :-)
|
|---|