in reply to Compact script for time difference in seconds

Hi :)

This is something I find I need quite often, and I usually do something like:

use Time::HiRes qw( time ); # If required my @t; $t[0]= time(); # do some stuff $t[1] = time(); my $diff = formatted_time_diff(@t); print "Processing took $diff seconds\n"; sub formatted_time_diff { return sprintf("%.2f", $_[1]-$_[0]) }

Hope this helps,