while () { my $code = (split)[1]; for my $x ( @all ) { if($code eq $x) { print $_; last; } } }