in reply to time it took script to complete

I just do:
my $time = time(); ... print time() - $time;
Usually with the part in the middle looping between 100,000 and 10,000,000 times so I can get an accurate reading of how much time is used per iteration. This method works fine for comparing algorithms, if not for returning the time it took the script to run.

NOTE: Since different amounts of system resources may be allocated for different runs of the script, you have to time all algorithms inside the same run of the script to get an accurate comparison.

Also see post 332827 for info on milliseconds.