Because you're effectively using a hash slice.
What that does is the @ in front of the hash presents its keys. Then if any of the keys match any elements in the array, those values are returned:
my %h = (1 => 'a', 2 => 'b', 3 => 'c'); my @a = (2, 3); my @b = @h{@a}; print "$_\n" for @b; __END__ b c
-stevieb
In reply to Re: Using a hash with the @ sigil
by stevieb
in thread Using a hash with the @ sigil
by 1nickt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |