Here you can see that testsub becomes a reference to an anonymous subroutine. I then call it by dereferencing it and passing it a parameter to print. I could have used shift instead but wanted it to be a bit clearer for this example.use strict; my $testsub = sub { print $_[0]; }; &{$testsub}("hi");
In reply to Re: Using references to subroutines
by simon.proctor
in thread Using references to subroutines
by firedoctor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |