in reply to Why doesn't quantifier work with character classes?
Try:
... if ($string =~ /^[ATGC]{8}$/) { ... [download]
Note the caret and dollar-sign. This should match sequences that are exactly eight characters long.