From: "Paul Johnson" <p...@pjcj.net> > On Tue, Apr 23, 2013 at 04:56:55PM +0530, kavita kulkarni wrote: >> Hello All, >> >> Can you help me in finding the most time effective way to retrieve the >> key-values from hash in the same sequence in which data is inserted into >> the hash. > > Hashes are unordered, so you cannot directly do what you are asking. > > Time effective for whom? If it's for you, take a look at > https://metacpan.org/module/Tie::IxHash > > If you're talking about execution speed, go with the simple solution > first and time and profile the solution before looking to optimise it. > You may find that the simple solution is good enough. > > -- > Paul Johnson - p...@pjcj.net > http://www.pjcj.net
Or you can also use Tie::Hash::Indexed. >From its POD: DESCRIPTION Tie::Hash::Indexed is very similar to Tie::IxHash. However, it is written completely in XS and usually about twice as fast as Tie::IxHash. Octavian -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/