See perlre. The carret negates the class, so the regular expression matches non-ACTG characters, but I used !~ to negate that. It's like the difference between
"The sequence doesn't contain invalid characters"
"The sequence contains valid characters"These two are not equivalent, as the second lacks the work "only".
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ