use warnings; use Date::Manip::Date 6.30; my$base = Date::Manip::Date->new; $base->config("setdate" => "now,utc"); my $delta = $base->new_delta("-30 days"); open my$infile, "<", "in.txt" or die; while (<$infile>) { my$cur = $base->new; my $parse_err = $cur->parse_format(q"\w+ %b %d %H:%M:%S %Y", $_); if ($parse_err) { 1; # input line does not contain a valid date, just skip it } else { my$mod = $cur->calc($delta); print $mod->printf("%a %b %d %H:%M:%S %Y"); } print "\n"; } __END__ #### Thu Feb 28 10:00:00 2013 Wed Feb 27 10:00:00 2013 Tue Feb 26 10:00:00 2013