in reply to problem of configration

The zero was dropped on the conversion from string to int - a leading zero on an int actually means octal. To put it back use sprintf or printf with a format of something like %04s. For example:
printf STDOUT "former_time is %04d\n", $former_time;

Update: And:
my $new_time = sprintf("%02d%02d", $new_hour, $new_mn);