use strict; use Time::Local; my $time = timelocal(localtime); $time -= (60 * 60 * 24); # subtract one day my ($s, $min, $h, $d, $mon, $y, $w, $yd, $isdst) = localtime($time); printf("Yesterday's date: %02d:%02d:%02d-%04d/%02d/%02d\n", $h, $min, $s, $y+1900, $mon+1, $d);