You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
429 B
Perl
17 lines
429 B
Perl
5 years ago
|
#!/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);
|
||
|
}
|