Cool/useful short examples of Perl?

Bill Crawford billcrawford1970 at gmail.com
Thu Jun 9 14:33:54 BST 2011


On 9 June 2011 13:39, Imre Saling <imre.saling at saling.ch> wrote:

> or to get the elapsed time since the last call to elapsed():
>
>  my $t0 = time;
>  sub elapsed {
...
>  }

sub start {
    return $last = time;
}

sub lap {
    my $t = time;
    push (@laps, $t - $last);
    $last = $t;
    return $laps[-1];
}

sub reset {
    (@laps) = ( );
}



More information about the london.pm mailing list