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