Do you know where your variables are? | |
PerlMonks |
Re^5: To read files from two dirby graff (Chancellor) |
on Apr 14, 2022 at 01:43 UTC ( [id://11142973]=note: print w/replies, xml ) | Need Help?? |
Just for fun, I deleted one of the two open-curly brackets at line 125, just to see what happens.
Naturally, when I ran "perl -cw" on the script, it still gave up, because the stuff you posted ends in the middle of an "if" block, and before giving up, it reported dozens of "'my' variable ... masks ..." warnings. But this time it also reported a bunch of "Global symbol '$SRC_DIR' requires explicit package name...", between lines 255 and 354. This is because two different lines above (123 and 128, near that f***ed up "foreach" line), which declare / assign to $SRC_DIR, are both commented out, so $SRC_DIR is never declared. (Presumably, you should uncomment just one of those lines, and maybe change what's being assigned to it, in order to avoid the compile-time errors. As for what needs to be done to make this rats-nest do anything properly, I have no idea.) UPDATED TO ADD: By the way, one more thing you need to know about that f***ed up "foreach" line: When you use "my" to declare the looping variable in a foreach loop, that declaration is only valid inside the scope of that loop. That would explain why any use of $SRC_DIR later in the script would be an error. Consider the following:
In Section
Seekers of Perl Wisdom
|
|