in reply to calculting time
Benchmark is handy. Time::HiRes is accurate - you'd need to grab time at the start and the end and subtract, or else use an interval timer.
After Compline,Zaxo