in reply to Timeleft subroutine
With regards to your code, $sparehour + 1; is a no-op; you probably meant $sparehour = 1;. This would have been flagged by warnings -- see Use strict warnings and diagnostics or die.
Also note that, since you are not using lexical variables (declared with my) your values for $spareminute and $sparehour will leak between calls. You can fix this by just replacing the assignments w/ modifications of the original variables, a la: $minutes -= 1; and $hour -= 1;.
Finally, you have a one-off typo on your return value: you have $minute in place of $minutes in my $baas = $hour + $minute + $seconds;. This would have been caught by strict, and looks like a bug that happened during debugging.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|