When you think reference, think \. There is also often an anonymous constructor available.
sub demo { print "This is the demo function I will pass\n"; } sub take_subs { foreach (@_) { $_->(); } } take_subs(\&demo, sub {print "Another way!\n"});
In reply to Re: subs as args
by Anonymous Monk
in thread subs as args
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |