in reply to Benchmark Runs Only Once
&$func does not give you a reference to the function, it calls the function:
> perl -wle "sub foo { print 'In foo' }; my $func='foo'; &$func" In foo
Had you used strict, Perl would have prevented you from making this error.
> perl -Mstrict -wle "sub foo { print 'In foo' }; my $func='foo'; &$fu +nc" Can't use string ("foo") as a subroutine ref while "strict refs" in us +e at -e line 1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Benchmark Runs Only Once
by ikegami (Patriarch) on Sep 30, 2010 at 17:06 UTC |