Your second charcter class does not include an underscore, but say it does:
m/^[a-zA-Z_]{1}[a-zA-Z0-9_]{7}(\.txt|\.TXT)$/
since you are using string anchors ^ and $ it will match 8 characters and then the file extension. If your regexp is matching filenames with more than 8 characters followed by the extension you are doing something wrong. But since you did not post samples of the data (like I asked) its hard to say. Instead of [a-zA-Z0-9_] you can use \w which is the exact same thing:
m/^[a-zA-Z_]{1}\w{7}(\.txt|\.TXT)$/
when I run that against some test names it works as expected.
Post all of your code and some sample data.