in reply to Re^3: To read files from two dir
in thread To read files from two dir
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: To read files from two dir
by graff (Chancellor) on Apr 14, 2022 at 01:43 UTC | |
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:
| [reply] [d/l] [select] |
by GrandFather (Saint) on Apr 14, 2022 at 02:12 UTC | |
We should emphasize for pragovnj's sake that using my in for loops to localize the loop variable is extremely highly recommended. Failing code as shown by you is almost always a logic error as well as a syntax error because the loop variable is aliased to each of the loop values and any variable of the same name outside the loop is not affected by the machinations of the loop! In particular a Perl for loop variable is not like a C for loop variable (where the loop variable retains its last value).
Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
| [reply] |
by pragovnj (Acolyte) on Apr 22, 2022 at 20:33 UTC | |
I had been away for a while from work due to some reasons and this issue is still pending. I will try to explain. In the original script, the topology files and the PM files were placed in the same directory, $VTIERBASE/pvc/ohdr/topology and the $SRC_DIR = $VTIERBASE/pvc/ohdr/topology. But in the new script, topology files are in $VTIERBASE/pvc/ohdr/topology and PM files are $VTIERBASE/pvc/ohdr/instance-0/preprocess. I need the $SRC_DIR to read both set of files from these two directories. I tried with the below
Please let me know if you need details Thanks | [reply] [d/l] |
by graff (Chancellor) on Apr 23, 2022 at 01:06 UTC | |
| [reply] [d/l] [select] |
by graff (Chancellor) on Apr 23, 2022 at 00:37 UTC | |
So... that would be the sort of "details" we would "need" if you really expect to make any progress based on help from us. Here's another suggestion: PLEASE -- PLEASE -- PLEASE: Edit that terribly long post of yours above -- the one with nearly 1200 lines of code in it -- and put a <readmore> tag above the beginning of the code, and a </readmore> tag at the end of the code. I'm SERIOUS!! DO IT!!! Because it is an awful PAIN IN THE A$$ to have to scroll over all 1200 lines every time I look at this thread. Thanks in advance. | [reply] [d/l] [select] |
by pragovnj (Acolyte) on Apr 25, 2022 at 20:38 UTC | |
by hippo (Archbishop) on Apr 25, 2022 at 22:31 UTC | |
| |
|
Re^5: To read files from two dir
by graff (Chancellor) on Apr 14, 2022 at 01:22 UTC | |
And before the perl interpreter gives up at line 1199 with the syntax error ("missing right curly..."), it reports dozens of warnings about "'my' variable ... masks earlier declaration in same scope ...". Note that the 1199 lines you managed to post DO NOT INCLUDE any of the line numbers cited in the error messages you've mentioned so far in this thread (1497, 1601, 1657). I did notice something that looks like it could be a mistake at line 125: Note the two open-curly brackets -- kinda looks like a typo. Funny thing... there's a close curly bracket at line 127 (that finishes the block that starts with the second open-curly). But there's no matching close-curly for that first open-curly -- across the nearly 1000 following lines (until the end of what's posted). You're obviously out of your depth here. Consider some simple questions:
You may think we're ganging up on you and giving you a hard time, but we're just trying to get you to do something with some hint of competence. | [reply] [d/l] |
|
Re^5: To read files from two dir
by GrandFather (Saint) on Apr 14, 2022 at 01:27 UTC | |
looks dubious.
Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
| [reply] [d/l] |