If I understand your question, here’s one way to do it: use glob
to find all files in the directory and grep
to filter them.
my $dir="/usr/test";
my @files = grep { /REGEX_HERE/ } glob("$dir/*");
2
solved How to support the searching file based on regular expression