Your skill will accomplish
what the force of many cannot
printing out a matrix for a data listby Angharad (Pilgrim)
|on Aug 05, 2006 at 13:21 UTC||Need Help??|
Angharad has asked for the wisdom of the Perl Monks concerning the following question:
I have been trying to do the following
Taking 'ob1' as the 'object of interest' I have a text file which looks like this
and what I need is to create a matrix like this
And for any 'duplicate results' like these
Only take the first instance (as the result is the same, regardless of the direction).
Ob2 then becomes the 'object of interest' and column two and row two is populated in the same way (but with different values potentially) as the first column and first row was populated with ob1 was the 'object if interest'. And the ob3 becomes the 'object of interest' until the matrix is completely filled. In some cases, there may be some missing values (for example there may not be a 'ob4 ob5' value and I need to take that into account - perhaps by printing 'NULL' or something).
I asked for help from Perl Monks yesterday and this is the code I have so far
The results I get using the code above is:
Which isn't quite what I need, but I don't know how to fix it (due to my blind spot regarding hashes I suspect).
Any suggestions much appreciated.