Hi Monks

I have a hash of array made of part_of_speech tags, being keys: WP/NP1/VB1/RB1/PP1/PP2... and each key is associated with an array of 1 or n set of tags (the same as the key) but in different order, and optional values between (), value are separated by colons :

key 1: WRB1/JJ1/VBZ1/NP1/IN1/NP2/ ; value: NP1/VBZ1/(so)/JJ1 : NP1/IN1/NP2/VBZ1/(really)/JJ1
key 2: WP/NP1/VB1/VBN1/PP1/ value: PP1/PP2/NP1/(are)/VB1/

My question is the following: having an array of questions, like
How/WRB1 hot/JJ1 is/VBZ1 the core /NP1 of/IN1 the earth /NP2 ?/

I extract for each question the tags (key-question) and compare with hash of arrays, and if it match one of the key
How will I extract the value from my hash of array, and take each set of tags, and look into the question to generate sentences (in another file) in the same order the set of tags indicated plus the optional values? so...

The answer will be: the core is (so) hot, and the core of the earth is (really) hot.
Thanks in advance!!

In reply to Match key and return value in some order by Anonymous Monk

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.