#!/usr/bin/perl -w use strict; my $targets = '1689 9679 6978 2792 2514 5472 1520 9342 5544 1268 0165 1979 7314 2101 7221 9539 3882 1812'; my $test = "2101"; if ($test =~ /$targets/) { print "OK"; } else { print "Not there"; }