in reply to Re: Passing references to subroutines with parameters
in thread Passing references to subroutines with parameters

Aijin!

I would follow runrigs lead. It's flexible and straight forward, and makes it easy to pass multiple arguments to sub_to_pass and the interface is consistent with fun things like  system.

sub sub_to_receive { # Example usage # sub_to_receive('123', \&sub_to_be_passed, 'arg'); # sub_to_receive('123', \&sub_to_be_passed, 'arg1', 'arg2'); # sub_to_receive('123', \&sub_to_be_passed, @args); # my ($x, $sub_to_run, @args) = @_; $sub_to_run->(@args, "lalala"); }

--
Clayton aka "Tex"