Passing a Function Object and Calling it
Here’s a complete, working script that demonstrates what you’re asking. sub a { print “Hello World!\n”; } sub b { my $func = $_[0]; $func->(); } b(\&a); Here’s an explanation: you take a reference to function a by saying \&a. At that point you have a function reference; while normally a function would be called … Read more