my $d = int( $seconds / 86400 ); my $h = int( ($seconds - $d*86400) / 3600 ); my $m = int( ($seconds - $d*86400 - $h*3600) / 60 ); my $s = $seconds % 60; print "$d days, $h hours, $m min, $s sec\n";