&$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.
In reply to Re: Benchmark Runs Only Once
by Corion
in thread Benchmark Runs Only Once
by InfiniteSilence
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |