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

In reply to Re: To read files from two dir by GrandFather
in thread To read files from two dir by pragovnj

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.