|Perl Monk, Perl Meditation|
Re: Print Hash Keys to a file for corresponding Hash valuesby ig (Vicar)
|on Nov 20, 2013 at 20:28 UTC ( #1063600=note: print w/replies, xml )||Need Help??|
I don't understand your description of your problem or what you want to achieve, so I am guessing here...
I guess you are having difficulty with the output to $outfile at the end of sub mainCSV and that you want "pin" and "related_input : " to be followed by the key and corresponding values from your hash.
If my guess is correct, there are a couple of problems:
The values of %hash are references to arrays, so I don't think the grep just after "Continue print with corresponding hash key and value for AsyncIn" does what you want.
Then, iterating a loop for the number of times there is a particular value in the hash doesn't make it easy to access the keys or values of the hash.
So, you need a different approach, and it is not clear from what you have presented exactly what you are trying to achieve.
Here is something for you to consider but, again, it is only a guess as to what you want and it is untested:
In Section Seekers of Perl Wisdom