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.
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.
please point me to the right direction.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";
Back to
Seekers of Perl Wisdom