osbosb has asked for the wisdom of the Perl Monks concerning the following question:

Can someone point me in the right direction or let me know what I'm doing wrong with the below peice of code? I am trying to use Benchmark::timethis to compare two ways of scraping /bin/. Per CPAN's doc page I am using the correct syntax.
#!/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' } );
Cpan says:
timethese(0, { test1 => '...', test2 => '...'})
Execution:
$ perl thing usage: $result = timethis($time, 'code' ); or $result = timethis($time, sub { code } );
What am I missing?

Replies are listed 'Best First'.
Re: Benchmark - timethis syntax?
by choroba (Cardinal) on Sep 01, 2011 at 16:14 UTC
    this is not these. Singular vs. plural.
      Thanks. I'll go sit in the corner now.