#!/usr/bin/perl
use strict;
use warnings;
use Benchmark qw(timethis);
my @bin = glob("/bin/*");
timethis(-2, { one => 'sort { -s $a <=> -s $b } @bin',
two => 'map $_->[0], sort { $a->[1] <=> $b->[1] } map [$_, -s $_], @bin'
}
);
####
timethese(0, { test1 => '...', test2 => '...'})
####
$ perl thing
usage: $result = timethis($time, 'code' ); or
$result = timethis($time, sub { code } );