I don't think any of your posts so far have made it clear exactly what you are trying to accomplish. Perhaps you could show what you want the new file to look like for your sample File1 and File2?
Some hints that may or may not apply depending on what you actually are trying to do:
If you want to produce a File3 where line X depends on line X of File1 and line X of File2, you need to be going through File1 and File2 at the same time, not in separate loops. See the question from a couple weeks ago: Combining Lines from Two Docs into Another
Make sure to only use "my" variables in their scope; they only last until the end of the innermost enclosing {}. If you try to use them beyond that point, you'll get the global variable of the same name instead. Put "use strict;" and "use warnings;" at the top of your script to be notified when you make this mistake (and others).
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.