in reply to split (grep)

Tip #1 from the Basic debugging checklist: warnings

tom tom;54 steve steve;56 Missing argument in printf at ... bill roger roger;99 Missing argument in printf at ... bob ---- 1 1 0 1 0

UPDATE: Is is this more like what you want?

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