> You have escaped the & sign in your call to the wanted subroutine.  You
> need to remove the backslash in front of the &wanted statement.

Are you sure about that?

SYNOPSIS
        use File::Find;
        find(\&wanted, '/foo','/bar');
        sub wanted { ... }

        use File::Find;
        finddepth(\&wanted, '/foo','/bar');
        sub wanted { ... }

DESCRIPTION
    The first argument to find() is either a hash reference
    describing the operations to be performed for each file, a code
    reference, or a string that contains a subroutine name. If it is
    a hash reference, then the value for the key `wanted' should be
    a code reference. This code reference is called *the wanted()
    function* below.

Jim, I don't have the original email but making $prefix a global variable
solve your problem? You could write a sub called find2() which is a wrapper
around the find() function and use closure that makes a sort of global
variable called $prefix availibe to those two subroutines. Something like
this:

while ( <DATA> ) {
 # your code
 find2( \&wanted, $path, $prefix );
}

{
 my $prefix_closure;  # can only be seen by find2() and wanted()

 sub find2 {
  $prefix_closure = $_[2];
  &find (\&wanted, $path);
 }

sub wanted ($) {
 return if -d $_;
 (my $ext = $_) =~ s/^.*\.(.*?)$/$1/;
 return unless exists $Extension{lc $ext};
 return unless  $File::Find::name eq /\Q$prefix_closure/i;
 if (-M _ < 1) {
 push @Files, $File::Find::name;
}

} # end closure

- Ron

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to