it's a common idiom to use map to create listified hashes map { $_ => 0 } LIST
A hash is commonly initialized from a list, e.g.
my %hash = qw(a 1 b 2 c 3);
Does the quoted idiom do anything other than generate another list with which to initialize a hash? Can a hash so initialized be considered in any way distinct from a hash created in any other way; in particular, can it usefully be distinguished as 'listified'?
orthogonality always makes sense!
A hash is commonly initialized from a list as in the example given above, and a hash is seamlessly 'listified' in list context as in a statement like
print %hash;
or
my @array = %hash;
but are lists (and, by extension, arrays) really orthogonal with hashes? Despite certain conceptual similarities, my inclination would be to say no: there are just too many differences:
Prototypes are just not mature enough!!!
Amen to that, brother! Or rather, they are just not well-named enough. Had they been better named, people like myself who come from C/C++land and adjacent regions would not know instantly what they are – and be instantly wrong!
In reply to Re^11: Is there any difference between prototype % and @ ?
by AnomalousMonk
in thread Is there any difference between prototype % and @ ?
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |