##
[Sat Jan 8 11:59:07 2011]: Normal Time Format
####
use Time::localtime;
sub timestamp {
my $t = localtime;
return sprintf( "%04d-%02d-%02d_%02d:%02d:%02d",
$t->year + 1900, $t->mon + 1, $t->mday,
$t->hour, $t->min, $t->sec );
}
print '[' . timestamp() . ']: Custom Time Format'. "\n";
####
[2011-01-08_12:06:05]: Custom Time Format