On Fri, 11 Mar 2005, Harald Ashburner wrote: > Is there an easy way to note and preserve ordering in a hash?
No. The whole point of a hash is store things in a random order that is distributed evenly and that the computer can look up quickly. A hash is, almost by definition, an unordered mapping of inputs to outputs. If you need to preserve the original order, you need to base your data structure on an array, or you need to maintain a parallel array that provides an index into the hash-stored data. The latter is much more complex and difficult to maintain, which means that going with an array is the right way to solve this. > I've had a think about using arrays in stead of hashes but it doesn't > seem to work easily as far as breaking up the data into sections etc. Ahh, the joys of managing complex data structures... :-) Of course, if we could see some code, &/or the data structure itself (maybe a snippet of Data::Dumper dump), it might be possible to give more constructive feedback... -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>