I have the following file I'm trying to read in and then use for configuration info:
These elements need to be kept together, as they are ProductTypeNumber and ProductTypeName. As you can see, keeping this info in a hash won't work, since I'd have duplicate keys. An array of arrays would seem better. This isn't much of a problem, except for the fact that the user might be able to edit the text file and screw up the ordering. I'd like to be able to read this all in and sort the data by element 1, then element 2. Being a relative n00b to Perl, I'm not sure how to apply array refernces and/or the <=> method in sort to get the data straight. Google tuned up nil, as did looking through the code snippets (well, nothing seemed to fit my problem very well). Any suggestions would be greatly appreciated.0,corkscrews 0,openers 0,toppers 1,glassware 1,stemware 1,tableware 2,bags 2,baskets, 2,boxes 3,books 3,magazines 3,postcards 3,clothing 4,canles 4,candlesticks 5,artwork
Soko
In reply to 2 dimensional array sorting... by Soko
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |