use strict; use warnings 'all'; my @DB = qw(AB1/1 AB1/5 AB2/5); my @Input = qw(AB1/1 AB1/2 AB1/5 AB1/6 AB1/9 AB2/2 AB2/5 AB2/6 AB2/9 AB2/13); for my $InputData (@Input) { my $found; for my $DBData (@DB) { if ($DBData eq $InputData) { $found = 1; last; } } print "$InputData : " . ($found?" ":" Not") . "Found\n"; } #### AB1/1 : Found AB1/2 : NotFound AB1/5 : Found AB1/6 : NotFound AB1/9 : NotFound AB2/2 : NotFound AB2/5 : Found AB2/6 : NotFound AB2/9 : NotFound AB2/13 : NotFound