while () { my $code = (split)[1]; for my $x (0..$#all) { if($code eq $all[$x]) { print $_; last; } } } #### while () { my $code = (split)[1]; for my $x ( @all ) { if($code eq $x) { print $_; last; } } } #### while () { my $code = (split)[1]; print if grep $_ eq $code, @all; } } #### my %all = map +( $_ => 1), qw(7723 7725 9908 7765 7874); $all{ (split)[ 1]} and print while ;