modulo returns the remainder. Try this:
use warnings; use strict; use 5.010; print 'result is ' . second_to_string (9000) . "\n"; sub second_to_string{ my $seconds = shift; say "seconds are $seconds"; my $hours = int ($seconds / 3600); say "hours are $hours"; my $remainder = $seconds % 3600; say "remainder is $remainder"; my $return = join('', $hours, 'h '); return $return; }
In reply to Re: solving modulo trouble
by hippo
in thread solving modulo trouble
by Aldebaran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |