Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
i have a function that takes an anonymous array of subroutines to do some 'stuff' with them, but i need to know how to pass the subs. I tried this:
This, however, just evaluates my_sub and gives take_subs the return value. What will work?sub my_sub { do_stuff } sub take_subs { do_more_stuff } take_subs([&my_sub]);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: subs as args
by Juerd (Abbot) on Jul 06, 2002 at 14:31 UTC | |
|
Re: subs as args
by broquaint (Abbot) on Jul 06, 2002 at 14:34 UTC | |
|
Re: subs as args
by Anonymous Monk on Jul 06, 2002 at 14:29 UTC | |
|
Re: subs as args
by flounder99 (Friar) on Jul 07, 2002 at 02:29 UTC | |
|
Take the next step into closures (Re: subs as args)
by dragonchild (Archbishop) on Jul 08, 2002 at 16:38 UTC | |
by merlyn (Sage) on Jul 08, 2002 at 16:45 UTC | |
by itub (Priest) on Jan 20, 2005 at 22:08 UTC | |
by dragonchild (Archbishop) on Jul 08, 2002 at 17:20 UTC |