#!/usr/bin/env perl use strict; use warnings; my %hash; for(qw/1689 9679 6978 2792 2514 5472 1520 9342 5544 1268 0165 1979 7314 2101 7221 +9539 3882 1812/) { $hash{$_}++; } my $tested = '2101'; if( exists $hash{$tested} ) { print "OK"; } else { print "Not there"; }