Using different modules, Time::Local and POSIX, is a direct way to compute today's date in UTC to compare to the dates in the file which are UTC. That avoids all the function calls in the loop you built, which really slow down the program.
in reply to Optimise the script
use Time::Local qw/ timegm_nocheck /;
use POSIX qw/ strftime /;
my $n = 4;
my ($d, $m, $y) = (gmtime)[3..5];
my $gmtime = strftime "%d/%b/%Y", gmtime timegm_nocheck 0,0,0, $d-$n,
$gmtime =~ s/^(?:0| )//;
print if /$gmtime\b/;
But to impliment some of the time saving 'tricks' suggested by others in this thread would involve a while loop with more code.