Welcome to the Monastery | |
PerlMonks |
Re: Running a script across multiple directories with multiple output files (problems comparing hash key values)by huck (Prior) |
on Aug 08, 2017 at 00:22 UTC ( [id://1196939]=note: print w/replies, xml ) | Need Help?? |
You have massive problems with variable scope. A "my" variable only "lives" withing the braces that surround it. Change the top of your file from to this And then try to understand what it is telling you. If you still are confused read this Variable Scoping in Perl: the basics. If after that you don not understand how to fix it come back and show us your progress. hint: the key will be to combine your c/d loops into a single loop. something like this
Note that i "escaped" the dot in the regexp. an escaped dot will match any character, while "\." matches a dot itself. Note that the close does not include the lessthan/greaterthan signs, those are used to read a file, not to reference it. Also note i closed them inside the same scope i opened them, this tends to be good practice. edit:See below Re: Running a script across multiple directories with multiple output files (problems comparing hash key values)
In Section
Seekers of Perl Wisdom
|
|