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

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

in a file1 i have statements like
-------------------------
strawberry red green rose
apple red rose
mango green
-------------------------
i want to convert this as
-------------------------
red strawberry apple
green strawberry mango
rose strawberry apple
-------------------------
and write the result in another file2.some said we have to use hash of hashes.i am new to perl.please any one help me!!