#! /usr/bin/perl -w use strict; sub foo { print "in foo\n"; my $bar = sub { print "in bar\n"; }; if(0 == @_) { $bar->(); } else { for (@_) { print "foo called with $_; "; $bar->(); } } } &foo(); &foo(qw(one two three));