http://www.perlmonks.org?node_id=924283

reubs85 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

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:

row_1 = one five two row_2 = four two row_3 = three one five four etc...

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:

one two three four five row_1 = 1 1 0 0 1 row_2 = 0 1 0 1 0 row_3 = 1 0 1 1 1 etc...

Any tips or pointers would be massively appreciated,

Thanks very much!