in reply to subs as args

When you hear "anonymous", think "reference".

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"});