in reply to Re: Help me understand this idiomatic hash from array code
in thread Help me understand this idiomatic hash from array code
"could have been stated in just this way: %fields = { id => 0, name => 1, age => 2};"
Assign a key/value pair to a hash:
%hash = ( key => "value" );
Assign a hashref as a hash key with no value:
%hash = { key => "value" };
Just sayin'.perl -MData::Dumper -wE 'my %fields = { id => 0, name => 1, age => 2}; + say Dumper \%fields;' Reference found where even-sized list expected at -e line 1. $VAR1 = { 'HASH(0x7f9d5a804850)' => undef };
|
|---|