my @foo = ( [ 1, 'foo' ], [ 2, 'bar' ], [ 3, 'baz' ], ); my %bar = ( 1 => [ 'a', 'b', 'c' ], 2 => [ 'd', 'e', 'f' ], 3 => [ 'g', 'h', 'i' ], ); for (@foo) { my ($num, $label) = @{ $_ }; print "$label: ", @{ $bar{$num} }, "\n"; }