http://www.perlmonks.org?node_id=582207


in reply to Re: My 'perldar' tells me there is a 'better' solution for this list operation
in thread My 'perldar' tells me there is a 'better' solution for this list operation

A couple of quick examples may make it easier to understand what a hash slice is doing. This code:

@hash{"one", "two", "three"} = 1 .. 3;

Is equivalent to:

($hash{one}, $hash{two}, $hash{three}) = 1 .. 3;

And likewise, these are equivalent:

my @list = @hash{"one", "two", "three"};

and

my @list = ($hash{one}, $hash{two}, $hash{three});