Jeff Smith wrote: > > I really need to order both the keys and one of the elements in the array > stored as a value in the hash, preferably sort first on the first element of > the array (my real application has four elements but the snippet I'm testing > with has a two-element array) and then sort secondly on the key. > > So if the reference to the array stored as the hash value is called > "$value", then there are two elements, $$value[0] and $$value[1], that it > references, right? > I want to sort first on $$value[0], then on the key for HofA, and to then be > able to print a report that lists all the data I need, including the two > sorted values plus also the other, non-sorted values stored in the HofA > array. That way the output is easier to read and summarize for the user. > > Does this make sense? I know how to sort by keys but sort first by the > value element and then by keys is my block...
Hi Jeff. I was hoping James would be around, but, briefly: A hash element is a key/value pair, but it is accessed uniquely by its key. You can sort the elements on any function of the key, the value, or both; but the result will be an ordered list of keys. Does that help? I hope so! Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>