in reply to Re: timing a command execution with perl
in thread timing a command execution with perl

Using gettimeofday and tv_interval makes it a bit simpler.

$ perl -Mstrict -Mwarnings -MTime::HiRes=gettimeofday,tv_interval -E ' my $t0 = [ gettimeofday() ]; my @psLines = qx{ ps -ef }; print qq{Command took }, tv_interval( $t0, [ gettimeofday() ] ), qq{ seconds to run\n};' Command took 0.015902 seconds to run $

I hope this is helpful.

Cheers,

JohnGG