$promoters_regex[0] = qr/[NT][GCATN][NG][NC][NG][NT][NG]/; $promoters_regex[1] = qr/[NG][NT][NG][NC][NG][GCATN][NT]/; $promoters_regex[2] = qr/[NA][GCATN][NC][NG][NC][NA][NC]/; $promoters_regex[3] = qr/[NC][NA][NC][NG][NC][GCATN][NA]/; ... $permutations_total++ while $string =~ $promoters_regex[$j]; #### for (@promoters_regex) { $total++ while $string =~ $_; }