use warnings; use strict; my ($idx_color, $idx_fruit) = (0,1); my $hoa = { keyone => ["green","apple"], keytwo => ["purple","plum"] }; my ($color, $fruit) = ( $hoa->{keytwo}->[$idx_color], $hoa->{keytwo}->[$idx_fruit] ); print "$color $fruit"; # prints "purple plum"