print localtime(time) . " ---- ". &getTimestamp . "\n"; sub getTimestamp { my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); if ($mon < 10) { $mon = "0$mon"; } if ($hour < 10) { $hour = "0$hour"; } if ($min < 10) { $min = "0$min"; } if ($sec < 10) { $sec = "0$sec"; } $year=$year+1900; return $year . '_' . $mon . '_' . $mday . '__' . $hour . '_' . $min . '_' . $sec; }