my @identifier = ("A1","B1","C1","D1"); my @idfeat = ("A1","B1"); my $pattern = join ( "|", @idfeat ); for my $eu ( 0 .. $#identifier ) { if ($identifier[$eu] =~ /$pattern/ ){ print "$identifier[$eu], Feature\n"; #my $sth=$dbh->prepare("INSERT INTO dd VALUES('$identifier[$eu]','Feature')"); #$sth->execute(); #$sth->finish; } else { print "$identifier[$eu], Bug\n"; #my $sth=$dbh->prepare("INSERT INTO dd VALUES('$identifier[$eu]','Bug')"); #$sth->execute(); #$sth->finish; } }