Perl - What scopes/closures/environments are producing this behaviour?
问题 Given a root directory I wish to identify the most shallow parent directory of any .svn directory and pom.xml . To achieve this I defined the following function use File::Find; sub firstDirWithFileUnder { $needle=@_[0]; my $result = 0; sub wanted { print "\twanted->result is '$result'\n"; my $dir = "${File::Find::dir}"; if ($_ eq $needle and ((not $result) or length($dir) < length($result))) { $result=$dir; print "Setting result: '$result'\n"; } } find(\&wanted, @_[1]); print "Result: '