in reply to Re^2: =~ matches non-existent symbols
in thread =~ matches non-existent symbols

It doesn't just contain actg; it also contains a newline. You need to chomp your input.