The subroutine is as shown below:
sub get_date {
# --------------------------------------------------------
my $time = shift;
$time or ($time = time);
my @months = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
my ($min, $hr, $day, $mon, $yr) = (localtime($time))[1,2,3,4,5];
$yr = $yr + 1900;
($min < 10) and ($min = "0$min");
($hr < 10) and ($hr = "0$hr");
($day < 10) and ($day = "0$day");
return "$day-$months[$mon]-$yr $hr:$min";
}
The most important subroutine that Perl uses
for telling the time is:
(localtime($time))[1,2,3,4,5]
where
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime();
so localtime($time)[1] would be $min which stands for minute
and localtime($time)[2] would be $hour which stands for hour and so on
Hope that helps
Sun
------------------
--------------------
Gossamer Threads Inc. ----------------------
Sun Djaja Email: sun@gossamer-threads.com
Internet Consultant
http://www.gossamer-threads.com