17 lines
429 B
Perl
17 lines
429 B
Perl
#!/usr/bin/perl -w
|
|
|
|
use strict;
|
|
|
|
my ($hours, $minutes, $seconds) = second2HourMinuteSecond(999);
|
|
print "999 seconds is $hours hours, $minutes minutes and $seconds seconds";
|
|
print "\n";
|
|
|
|
sub second2HourMinuteSecond {
|
|
my ($h,$m);
|
|
my $seconds = shift;; # defaults to shifting @_
|
|
$h = int($seconds/(60*60));
|
|
$seconds %= 60*60;
|
|
$m = int($seconds/60);
|
|
$seconds %= 60;
|
|
($h,$m,$seconds);
|
|
} |