Hi everyone.
Is it possible to read two file in parallel and grab values from them?
I mean, let's say I have two input file. The first is like this:

alligator-n attri aggressive-j 0.0521953848067504 alligator-n attri aquatic-j 0.0428300684553727 alligator-n attri big-j 0.125268137962678 alligator-n attri carnivorous-j 0.0218253043999405 lizard-n hyper creature-n 0.618765795370872 lizard-n hyper reptile-n 0.466342631493931 lizard-n hyper vertebrate-n 0.249202543226053 lizard-n mero blood-n 0.397326263768692 dishwasher-n random-v prevent-v 0.00856940857204332 dishwasher-n random-v qualify-v 0.00675098458337709 dishwasher-n random-v top-v 0.0114499058531553 dishwasher-n random-v visit-v 0.0134718844088632 freezer-n attri big-j 0.0865285153310031 freezer-n attri clean-j 0.078801694198009
and the second like this:
alligator-n attri aggressive-j 0.345621780 alligator-n attri aquatic-j 0.46634263149393 alligator-n attri big-j 0.125268137962678 alligator-n attri carnivorous-j 0.0218253043999405 lizard-n hyper creature-n 0.618765795370872 lizard-n hyper reptile-n 0.466342631493931 lizard-n hyper vertebrate-n 0.0428300684553727 lizard-n mero blood-n dishwasher-n random-v prevent-v 0.00856940857204332 dishwasher-n random-v qualify-v 0.00675098458337709 dishwasher-n random-v top-v 0.125268137962678 dishwasher-n random-v visit-v 0.0134718844088632 freezer-n attri big-j0.078801694198009 freezer-n attri clean-j 0.397326263768692

That is they are exactly the same, except for the last value.
How can I read them in order to confront the last value of each line of the first file with the value of the exactly same line in the second file?For each line I have to apply the following formula: value_from_the first*(1-value_from_the_second).
My output should look like the input, except for the last value, which should be derived as the previous formula suggested.
Thanks a lot.
Giulia


In reply to Read and analyze two file in parallel by remluvr

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.