Avatar of smovva1
smovva1

asked on 

readdir and grep

In perl, I have 2 variables. One is the customer name and another is the date. And exclude . and ..

I need to get the files that match this criteria.
I am not sure how to use grep to do this..

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
my $yesterday = sprintf("%04d%02d%02d", $year+1900, $mon, $mday-1);
my $customer = "abc";

  @files = grep /$yesterday/, readdir(DIR);
         print "File count = @files\n";
PerlLinux OS Dev

Avatar of undefined
Last Comment
smovva1

8/22/2022 - Mon