in reply to cannot get Benchmark to work
You can't write \&a(\@foo) - you can take a reference to a subroutine like \&a, but then you can't specify parameters.
One solution is to create an anonymous subroutine that does the call:
a => sub { a(\@foo) }, b => sub { b(\@foo) },
Another approach (usually recommended with Benchark) is to provide a string to eval rather than a subroutine reference:
.. but in that case you need to be careful with variables: your my() variables won't be visible to Benchmark when it evals these, so you'd need to declare @foo in this case as a package variable:a => q{ a(\@foo) }, b => q{ b(\@foo) },
our @foo = 1..10;
Hugo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: cannot get Benchmark to work
by polettix (Vicar) on Jul 04, 2005 at 13:34 UTC | |
by fishbot_v2 (Chaplain) on Jul 04, 2005 at 15:05 UTC | |
by Anonymous Monk on Jul 05, 2005 at 11:51 UTC |