|Perl Monk, Perl Meditation|
making presence/absence table from a hash of arraysby reubs85 (Acolyte)
|on Sep 05, 2011 at 18:21 UTC||Need Help??|
reubs85 has asked for the
wisdom of the Perl Monks concerning the following question:
Please impart some Perl wisdom to a poor and pitiful Monkling...
Allow me to paint a simplistic picture of my conundrum: I have an array with (for arguments sake) 5 elements, thus:one two three four five
And I have a hash where the keys are row numbers and the values are references to an array; this array having a varying number of elements that are equal to the headers in the table, but not necessarily in the same order, like so:
What I would dearly like is to print a table where each cell is filled with a 1/0 presence/absence binary, depending on if the column header in question is present in the array, thus for the hypothetical example above, we would get:
Any tips or pointers would be massively appreciated,
Thanks very much!