my @ta = ("a x", "b y", "c z", 'b yyy'); my $key = 'b'; my @values = map / (.*)/, grep /^$key /, @ta; print "@values\n";