in reply to Passing arguments to wanted subroutine in File::Find

Some people do this using closures to parameterize the wanted() subroutine.
use File::Find (); look_for_this_ext( 'pl', '.' ); sub look_for_this_ext { my $this_ext = shift; my $this_tree = shift; my $wanted = sub { # print " I see '$_'\n"; print " '$_'\n" if /\.${this_ext}\z/; }; File::Find::find( { bydepth => 1, no_chdir =>1, wanted => $wanted, }, $this_tree, ); } __END__ './anony001.pl' './anony002.pl' './jmw1.pl' './liz.pl' './template0.pl' './demerphq/treap.pl'