Flemming Mahler Larsen <mahler@tdcinternet.dk> writes:
> --
> use Date::Calc;
>
> my ($year,$month,$day, $hour,$min,$sec) = Date::Calc::Today_and_Now();
> my $tid = sprintf "%02d%02d", ($hour,$min);
Hvilket er stort set det samme som:
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
my $tid = sprintf "%02d%02d", ($hour,$min);
Uden dog at skulle bruge underlige perlmoduler.
Hvis det er for langt, så:
my $tid=sprintf"%02d"x2,(localtime)[2,1];
Hvad er overhovedet fordelen ved Date::Calc::Today_and_Now ud over at
det er længere at skrive og man får mindre information ud af den?
--
Peter Makholm | Ladies and gentlemen, take my advice, pull down your
peter@makholm.net | pants and slide on the ice
http://hacking.dk | -- Sidney Freedman