On 06/09/2011 01:39 PM, Imre Saling wrote:
Quoting "Ruud H.G. van Tol" <rv...@isolution.nl>:

# see also perlvar: $BASETIME
{ my $t0 = time; sub elapsed { time - $t0 } }

or to get the elapsed time since the last call to elapsed():

my $t0 = time;
sub elapsed {
  my $t = time;
  my $dt = $t - $t0;
  $t0 = $t;
  return $dt;
}

If we're talking about modern Perl, then that looks like a perfect use for a state variable.

Dave...

Reply via email to