$^T is the time that the script started. So end your script by returning
time()-$^T. You might want to put this in the sig die handler:
# your script goes here
BEGIN { $SIG{__DIE__} = sub { print + time() - $^T, $/, @_ } }
print + time() - $^T, $/
That prints the run time of your script in seconds.
Update: By the way, there is a module called Benchmark that is great for testing algorithms and routines and such. Turnstep wrote a great tutorial on it called Benchmarking Your Code
Update: For a variety of reasons, it is much better (and simpler too!) to use a single END block instead of the repition that I suggested. Thanks merlyn for pointing this out. (I also like the use of warn)
Also, If your script is taking longer then a minute or two, you might want to break down those seconds to be minutes:seconds, but don't forget the more work you do after that last call to time, the less accurate the stamp. (Well, time only has a granularity of a second... so you actually have plenty of room, but anyway...)
END { $a=time-$^T, warn sprintf "Runtime %d min %d sec\n", $a/60, $a%6
+0 }