in reply to Subroutine reference
In the second, you have the reference operator followed by a subroutine name. This returns a reference to the named subroutine.
In the first, you have the reference operator followed by a subroutine call. Subroutine calls evaluate to the value returned by a call to the subroutine. You're making a reference to that.
The solution is to wrap the call in a subroutine that takes no argument, and take a reference to that subroutine instead.
my $subref = sub { testing(1,2,3,4,6) };
|
|---|