D
David Filmer
I can define a hash thusly (this works):
my %food_price = ( 'Hotdog' => 1.00, 'Popsicle' => 0.50 );
Or, similarly:
my %food = ('H' => {label => 'Hotdog ', price => 1.00 },
'P' => {label => 'Popsicle', price => 0.50 });
But the syntax seems inconsistent to me. I would expect to use curlys to
enclose %food (not parens). I associate curlys with hashes. Is there some
rationale behind the fact that Perl uses parens to populate a hash in this
way? Just curious.
curlys = { }, parens = ( )
my %food_price = ( 'Hotdog' => 1.00, 'Popsicle' => 0.50 );
Or, similarly:
my %food = ('H' => {label => 'Hotdog ', price => 1.00 },
'P' => {label => 'Popsicle', price => 0.50 });
But the syntax seems inconsistent to me. I would expect to use curlys to
enclose %food (not parens). I associate curlys with hashes. Is there some
rationale behind the fact that Perl uses parens to populate a hash in this
way? Just curious.
curlys = { }, parens = ( )