Cool/useful short examples of Perl?

Imre Saling imre.saling at saling.ch
Thu Jun 9 13:39:36 BST 2011


Quoting "Ruud H.G. van Tol" <rvtol at isolution.nl>:
>
>     # see also perlvar: $BASETIME
>     { my $t0 = time; sub elapsed { time - $t0 } }
>
> -- 
> Ruud


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;
   }

-pelagic



More information about the london.pm mailing list