use Time::Local; my $midnight_time = timelocal(0,0,0, (localtime)[3,4,5] ); print scalar localtime $midnight_time;