cmpthese requires an anonymous hash, whose values are subs to execute. This should be better.
#!/usr/bin/perl -w use strict; use Benchmark qw(cmpthese); my $file1 = 'first.pl'; my $file2 = 'second.pl'; cmpthese (-5, { 'first' => sub { chdir "/home/firstdir/"; do $file1}, 'second'=> sub { chdir "/home/seconddir/"; do $file2} });
In reply to Re: First time with Benchmark
by cchampion
in thread First time with Benchmark
by Ineffectual
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |