Do you know where your variables are? | |
PerlMonks |
Re: File::Find in a loopby NetWallah (Canon) |
on Apr 28, 2013 at 16:07 UTC ( [id://1031093]=note: print w/replies, xml ) | Need Help?? |
The "wanted" sub uses a GLOBAL $dir in your code. (Before I get flamed - what I mean is GLOBAL to the sub. The example below uses a lexical variable that is global to the sub) In the "for my $dir" loop, $dir is LOCAL to the block enclosed by the "for" loop, so the "wanted" sub cannot see it. To fix, keep $dir global:
"I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
In Section
Seekers of Perl Wisdom
|
|