my @t = localtime(time);
my ($rf, $td);
$t
4++;
$td = (1900 + $t
5) . ((length($t
4)==1)?(0 . $t
4):$t
4) . ((length($t
3)>1)?$t
3:(0 . $t
3)) . ((length($t
2)==1)?(0 . $t
2):$t
2) . ((length($t
1)>1)?$t
1:(0 . $t
1)) . ((length($t[0])>1)?$t[0]:(0 . $t[0]));
open(PLOG, ">>/usr/perl_scripts/$td.log");
print PLOG "Hello World";
close(PLOG);
The above sample script will create the log file with date and time.