sub wanted { my ($spls) = @_; ... you can use $spls here ... } sub search { ... find(sub { wanted($spls) }, $seek_path); ... } #### sub search { ... find( sub { ... you can use $spls here ... }, $seek_path ); ... }