Why do you need the '@' preceding the hash name and not a '$'?
Because you are accessing the hash in list context. Did you try it with a $ as sigil? Doing so will result in
$VAR1 = { '3' => 3 };
because $hash{@keys} is a scalar. So, the array @keys is evaluated in scalar context, which yields 3 (three elements). The scalar context on the left of the assignment enforces scalar context on the right, so that's also 3 (three elements.)
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re: meaning of '@' sigil on a hash?
by shmem
in thread meaning of '@' sigil on a hash?
by awohld
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |