@foo = qw/tom steve bill roger bob/; @bar = qw/roger;99 steve;56 ted;88 tom;54/; foreach $line(@foo){ foreach $line1(@bar){ @split1=(split/;/,$line1); if($line =~ $split1[0]){ printf("%5s %3s\n",$split1[0],$split1[1]); } } } __END__ tom 54 steve 56 roger 99