use strict; sub div_mod { return int( $_[0]/$_[1]) , ($_[0] % $_[1]); } my $i = 1332443; my ( $s, $m, $h, $d ); ($m,$s) = div_mod($i, 60); ($h,$m) = div_mod($m, 60); ($d,$h) = div_mod($h, 24); print "$d days, $h hours, $m minutes, $s seconds.\n";