$filename = "input.txt"; open (IN, $filename) or die "Can't open file $filename : $! "; $text = ""; while($line = ) { $text .= $line; } while($text =~ m/(TATAAT[ACGT]+(ATG[ACGT]+(TGA|TAG|TAA)))/g) #we check for DNA Strands along with TATA box #promoters..(TATAAT string) { print "$2\n"; }