my $date = `date`; my @cdate = split(/ /, $date); my $cmonth = mapmonth($cdate[1]); my $delstart = ($cmonth - 2); my $delstop = ($cmonth + 1); my @range = ($delstop .. $delstart); [...] if ($monthnr != @range)  { open(NEWWTMP,">>$newwtmp"); print NEWWTMP $_; }