And, if you're working on a Windows system, you can use the Win32::GetTickCount() function, like this:
$start = Win32::GetTickCount();
sleep(2); #or some other crazy pieces of code
$end = Win32::GetTickCount();
$length = $end - $start;
print "It took us $length milliseconds to do the job.\n";