#!/usr/local/bin/perl -w use strict; sub foo { $_[0]->(); } sub bar { print "here: $_[0];\n"; } # invoke directly &bar("foo"); # invoke 'indirectly' # however, there's no way to pass in arguments to an # anonymouse subroutine? # (note: will die with use strict since @_ would # not have been initialized) # foo (sub { print "here: $_[0];\n"; }); # say, like this... foo (sub ("foo") { print "here: $_[0];\n"; }); # or, even (rather wicked)... # foo (sub { print "here: $_[0];\n"; }("foo")); # i know it looks absurd; however, shouldn't there # be a quicker way to make a do with anonymous subs # rather than using explicit sub declarations # when there's a need to also pass certain arguments # to the anonymous sub? #### use File::Find; sub get_subdirs { my ($dir,$skip_match) = @_; # i can't figure how to pass $skip_match?? so that it could be used # inside the anonymous sub invoked by find(). my @dirs = find(sub { (my ($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && -d _; }, $dir); \@dirs; }