Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Array and Hashby Loops (Curate) |
on Nov 23, 2014 at 22:49 UTC ( [id://1108189]=note: print w/replies, xml ) | Need Help?? |
Hello. You lost me a bit about the mapping between the input text file and the hash. The values don't match and yet you want Key1 and Key3 in your output? I'm going to assume that was a typo, and what you're asking is to match that first string on each input line to the values contained in your hash:
Prints:
Hopefully that looks right to you. The main hash is reversed so we can use %lookup to find matching values and discover the associated key. Reverse will put the values into the keys, with their respective keys as values. Everything else falls into place.
In Section
Seekers of Perl Wisdom
|
|