my %wanted = map {$_ => 1} 40, 47, 76; for my $n (0 .. 267) { print "$n\n" if exists $wanted{$n}; }