while (time) { $Seconds = substr(time,-3,1); if ($Seconds == 4&&$Factor != 1) { print "It begins."; $Factor = 1; } elsif ($Seconds == 5&&$Factor == 1) { print "It ends."; $Factor = 0; } $Input = ; chomp($Input); if ($Input eq "time") { print time; print "\n"; } elsif ($Input eq "quit") { exit; } }