Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Thank you in advance for answering my question, I have been searching all afternoon for the correct regex to use and I feel the need to elevate the issue.

I am searching through a series of files, the beginning of the filename is guaranteed to have the first 6 characters as A-Z, the next two characters will be any combo of A-Z,0-9. The following two characters are A-Z. It is these last two characters that I am trying to match. I am running into problems where I am matching characters accidentally from the first part of the filename. E.g. If if I were searching for TL, STTLWA02TL01_2011-10- would correctly match, STTLWA02HJ01_2011-10- would erroneously match.

So my question is: how can I match my desired characters after the 8 initial characters?

This regex is obviously insufficient, since if $prompt_host = "TL", it will match it anywhere in the filename.

#Populate @traffic_file_list while (my $file = readdir(DIR)) { if($file =~ $prompt_host) { push(@traffic_file_list, $file); } }

Thank you!