http://qs321.pair.com?node_id=805459

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

Dear Monks,

I'm doing a directory listing for files with pattern YYYYMMDD.HHMMSS.host2.pid and want to exclude other files.
I'm using read_dir method from File::Slurp . The below script gives me '0' files after execution. What's wrong with the grep.
use strict; use warnings; use File::Slurp; my $path="/tmp/test"; my @files = grep { -f and /^\d{8}\.\d{6}\.host\d\.\d{1,6}$/ } read_dir + $path; print "Got ". scalar(@files) . "\n";
please point me to the right direction.