sub my_map { my $sub = shift; my @out; for ( @_ ) { push @out, $sub->(); # $sub will get its arg from $_ } return @out; }