use strict; use File::Find; # make a closure that invokes &$arg2 on any filename that # ends in $arg1 sub makeExtClosure { my ($ext, $action) = @_; return sub { /$ext$/ && &$action; }; } find(makeExtClosure("pod", sub{print "$_\n"}), ".");