..but I want to do it in Perl

Hi, As addendum to the above perfectly fine responses, i would also like to suggest you come up with a loose design for this solution
If its just a P.o.C to test your Perl skills,its always good to start from scratch reading thru the links mentioned by the monks, focusing on File I/O operations, a great way to start learning perl.
Please search on PM,or see this post How to combine multiple files together if you want industry grade program alternatives, though through the years, you will find, *there's more than one way to do it*.


The Great Programmer is one who inspires others to code, not just one who writes great code

In reply to Re: Combine files with same extension in new file by perlron
in thread Combine files with same extension in new file by AhmedABdo

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.