> -----Message d'origine----- > De : John W. Krahn [mailto:[EMAIL PROTECTED] > Envoyé : jeudi 22 septembre 2005 23:26 > À : Perl Beginners > Objet : Re: Is it possible to force a particular order in a hash? > > > Dave Adams wrote: > > I have a hash that I need to use later and display some values in a > > particular order. Perl comes up with its own way of > ordering it but I > > am wondering if I can instruct perl to have it listed in > the way that > > I want. > > You could store the ordered keys in a separate array or you > could use the Tie::IxHash module.
I'm wondering if Tie::IxHash is suitable here. Indeed, from the module doc i'm reading the following: "This Perl module implements Perl hashes that preserve the order in which the hash elements were added". It seems that the OP here wants to "customize" the order, not only preserve the order in which elements were added during hash contruction. Input order: AUTHOR LANGUAGE TITLE Desired output order: TITLE AUTHOR LANGUAGE Suggestion from Waldemar Jankowski looks promizing ... Regards, José. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>