Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: To read files from two dir

by GrandFather (Saint)
on Apr 11, 2022 at 20:55 UTC ( [id://11142923]=note: print w/replies, xml ) Need Help??


in reply to To read files from two dir

What do you mean by "combine"? Do you mean copy them into the same directory, or do you mean concatenate them into one file and put the result in some directory, or do you mean process first one then the other in the same operation?

What do you mean by "not working". Are there error messages (if so, what - be specific), does the processor in your computer melt, or does something else happen or not happen? I can't tell where you are having trouble, but you might like to start from here:

use strict; use warnings; my @srcDirs = ("newDir1", "newDir2"); for my $SRC_DIR (@srcDirs) { print "Source dir: '$SRC_DIR'\n"; }

and expand that code just enough to demonstrate the issue. Don't do any more work than adding file name variables and manipulating them, then printing the result so you can see, and can show us, how you expect the file names to be handled.

For reference, the code above prints:

Source dir: 'newDir1' Source dir: 'newDir2'

Show us what your equivalent code prints and tell us what you expected to get.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

Replies are listed 'Best First'.
Re^2: To read files from two dir
by pragovnj (Acolyte) on Apr 13, 2022 at 18:12 UTC

    I tried putting all the files together in one single dir,

    my $SRC_DIR         =        "/pvc/ohdr/topology";

    I did not get any errors such ” Global symbol "%lookup_F3" requires explicit package name…..” But when I tried with

    my @dir = ("$VTIERBASE/pvc/ohdr/topology","$VTIERBASE/pvc/ohdr/instanc +e-0/preprocess"); foreach my $SRC_DIR(@dir) {

    I get any errors such ” Global symbol "%lookup_F3" requires explicit package name…..” Also, I do not see any output on print statement

      You persist in giving us snippets which show none of the variables you're getting in your error messages. You were told this two days ago (Re^3: To read files from two dir).

      On what planet do you believe that repeatedly posting unrelated truncated code samples could be useful in diagnosing your problems? It's possible that because of the block structure in SOME OTHER CODE YOU HAVEN'T SHOWN that adding that new for with its BLOCK could be changing the scoping somewhere down the line and invalidating or hiding a variable declaration. But we can't know that because no one has seen enough code with supporting context so we're stuck with generalities and handwaving guesses.

      Help us help you.

      /me mutters something about porcine singing . . .

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.

      A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11142923]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-25 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found