perl reference hash slice -


i have below hash:

my %gilligan_info = (         name            =>      'gilligan',         hat             =>      'white',         shirt           =>      'red',         position        =>      'first mate', );  %skipper_info = (         name            =>      'skipper',         hat             =>      'black',         shirt           =>      'blue',         position        =>      'captain' ); 

i have array of hashes:

my @crew = (\%gilligan_info, \%skipper_info); 

i created reference:

my $ref = \%{$crew[1]}; 

i'm pulling key values second hash:

my @ref_values = @{$ref}{ qw ( name position hat )}; 

my question is, how can values of hashes not specifying element number in reference "$ref"?

thanks

if want values of hashes in single array,

my @ref_values = map @$_{ qw(name position hat) }, @crew;