
$target_number = shift @ARGV;
LINE:
while (<>) {
  @numbers = split;
  foreach $n (@numbers) {
    if ($n == $target_number) {
      push @lines, $.;
      next LINE;
    }
  }
}
print "Target number $target_number ";
if (@lines) {
  if (@lines == 1) {
    print "found on line @lines.\n";
  } else {
    $linelist = join ", ", @lines;
    print "found on lines $linelist.\n";
  }
} else {
  print "not found.\n";
}

