use warnings; use strict; my @foo = qw/tom steve bill roger bob/; my @bar = qw/roger;99 steve;56 ted;88 tom;54/; for my $name (@foo) { my @match = grep { /$name/ } @bar; print "$name $match[0]\n" if @match; } __END__ tom tom;54 steve steve;56 roger roger;99