Hello chaney123,

Fellow Monk afoken is absolutely right. You need to work on the solution to your problem in your mind first and then put it down to paper. The task is fairly easy even for a beginner. It is not about us providing you with the solution it is about you learning on the process by trying and failing, again and again.

Having said that, there are multiple ways of resolving your problem. One possible way that is as much simple as possible could be:

Step 1: open both files in reading mode (I assume you know how to do that).

Step 2: read the files and place them into arrays, see here how to do that on a relevant question How to populate array with lines from text file? (Moved from Q&A) (close files after putting the data into the arrays).

Step 3: iterate on both arrays (so you can read one line at a time simultaneously). Sample of code on similar question How do I Loop over multiple arrays simultaneously ?. Update: (I just noticed that both files are not equal). So one possible way is to check if the element exist in the array if not, apply next. Experiment and see what are your problems and try to resolve them.

Step 4: Do what ever modification on the lines append to each other based on the data that you have.

Step 5: open a file in writing mode, export the data and you are done. :D

This is a high level implementation, there is a very small tricky point that you need to resolve regarding the data processing. You need to resolve this on your own, remember it is all about trying and failing. If you encounter any problems post your code, tell us where you failed and we will assist.

Hope this gave you a direction of proceeding, BR.

Seeking for Perl wisdom...on the process of learning...not there...yet!

In reply to Re: How to combine these two files? by thanos1983
in thread How to combine these two files? by chaney123

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.