in reply to read the whole folder files
perhaps:my @files = grep {/_*_.txt/} readdir DIR;
is all that you need? The $ anchors the regex to the end of the string. An underscore "_" would be unusual before a .txt ending. Without escaping the "." like "\.", the dot means any character, which doesn't look like that you want.my @files = grep {/\.txt$/} readdir DIR;
When debugging, print @files to make sure that you are getting the files that you want.
|
|---|