http://qs321.pair.com?node_id=1131299


in reply to solving modulo trouble

In math terms, when you do a division problem, dividing gives you the quotient and taking the modulo gives you the remainder. Here, dividing a number of seconds by 3600 and dropping the decimal gives you the hours. Taking the modulo gives you the remainder of seconds:

my $s = 7209; # 2 hours and 9 seconds my $hours = int $s/3600; my $seconds = $s % 3600;

Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.