in reply to Re: Pass sub reference
in thread Pass sub reference

...or maybe, if you want to pass around the arguments together with the function, you can wrap the call in another sub:

... sub yyy { my $func = shift; $func->(); } yyy( sub { xxx("foo", 42) } );

Replies are listed 'Best First'.
Re^3: Pass sub reference
by AnomalousMonk (Archbishop) on Oct 29, 2010 at 00:59 UTC

    Which is to say (warning: semi-advanced topic, but not really all that scary): Use a closure. See tutorial Closure on Closures.