use POSIX 'strftime'; my $date = strftime '%Y%m%d', localtime; my $re = qr/whatever/; my $count = 0; for (glob "/path/to/*$date*") { local $/; # to slurp open my $fh, '<', $_ or warn $! and next; my $content = <$fh>; close $fh; $count += () = $content =~ /$re/g; } print $count,$/;