T said:
Forgive me if I'm wrong, but in this case, wouldn't {} refer to an
anonymous hash?
Only when you (rather rudely, IMHO) snip the appropriate context.
my %hash = map { $_ => 1 } @foo;
{ $_ => 1 } is the block (or anonymous subroutine) that's passed as the
first argument to map. This block returns a two element list.
If the code was something along the lines of
my $hash_ref = { $_ => 1 };
then the braces would, indeed, create an anonymous hashref.
map()'s prototype, effectively, is:
sub map(&@);
which, perldoc perlsub tells us: "An & requires an anonymous
subroutine, which, if passed as the first argument, does not require
the sub keyword or a subsequent comma"
For more information:
perldoc -f map
Paul Lalli