Hellow Monks.

I'm learning perl nowadays. It's very interesting.

But I have a problem. I can't solve....

please help me to solve this problem.

I want to merge two files.

but merged new file must have some format. and I want to know how I can do it.

and I don't want to solving problem by using modules, packages.

here's format

---------------------------------------------

file1 format

key key2 var0 var1 var2 data1

A A-0 a10 a11 a12 8

A A-1 a10 a11 a12 12

A A-2 a10 a11 a12 5

A A-3 a10 a11 a12 8

A A-4 a10 a11 a12 2

A A-5 a10 a11 a12 15

A A-6 a10 a11 a12 8

A A-7 a10 a11 a12 12

A A-8 a10 a11 a12 15

A A-9 a10 a11 a12 8

B B-0 a10 a11 a12 7

B B-1 a10 a11 a12 2

B B-2 a10 a11 a12 6

B B-3 a10 a11 a12 9

B B-4 a10 a11 a12 16

B B-5 a10 a11 a12 19

B B-6 a10 a11 a12 10

C C-0 a10 a11 a12 1

C C-1 a10 a11 a12 3

C C-2 a10 a11 a12 16

C C-3 a10 a11 a12 11

C C-4 a10 a11 a12 10

----------------------------------------------

file2 format

key var10 var11 data2

A b00 b01 6

A b00 b01 9

B b00 b01 10

C b00 b01 11

B b00 b01 9

A b00 b01 13

--------------------------------------------------

result file format ( file1 + file2)

key var10 key2 var0 var1 (data2-data1) key2 var0 var1 (data2-data1) key3 var0 var1 (data2-data1)

--------------------------------------------------

there are three key2 because I choose three lists in file1 that is most small in the range -5 <(data2-data1) < 5.

if there are two in the range than you can choose two. If there are four in the range then you can choose three that are most small number (data2-data1)

please. help me.


In reply to merging 2 files to one problem by kjsunny

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.