in reply to Checking users online
... I would recommend using sprintf instead:
For your date calculations (adding one time value to another), you can do it much more succinctly with Date::Calc.