in reply to Date/Time
Also, get rid of the length calls and just use sprintf to do the leading zero format padding, if necessary.
(And don't forget, the year bit of localtime() returns the number of years SINCE 1900. That's by design (libc, in this case). So don't prepend 19 to it.
Bad:
my $year = (localtime())[5]; print "The year is 19$year\n";
Good:
my $year = (localtime())[5]; print "The year is " . 1900+ $year . "\n";
|
|---|