in reply to Re: Pass an "extra' variable to Find::File subroutine
in thread Pass an "extra' variable to Find::File subroutine

As you have it (and as you say), $source would be passed to the Recursive function.  However, it's meant to be the second argument to File::Find's find function (the top-level directory to start recursing from), as that's how its API is defined.

Replies are listed 'Best First'.
Re^3: Pass an "extra' variable to Find::File subroutine
by moritz (Cardinal) on Jun 22, 2010 at 14:23 UTC
    You are right, my mistake. If I understand the question correctly, it should actually be
    sub myfind { my ($code, $source, @args) = @_; find(sub { $code->(@args)}, $source) } myfind(\&Recursive, $source, $addtional_argument)
    Perl 6 - links to (nearly) everything that is Perl 6.
      Thanks, that was exactly it! It works! To be honest: I don't have any idea what the code does (or better: how it works), but for now I'm happy my problem is solved. And for later, I'm gonna try to find out how you solved my problem! :) Thanks again, Tim
      The great mistake is to anticipate the outcome of the engagement; Let nature take it's course, and your tools will strike at the right moment.