use strict; my $text = 'f000124_90181234_dp'; my $sites = [ '018', '324' ]; if (grep {$text =~ /_9$_/} @$sites) { print "To be removed..\n"; }