You can sort the keys of the hash, but that will eliminate benefit of
the speed of Perl's hash lookups.

Mike 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Viljo
Marrandi
Sent: Thursday, June 06, 2002 9:49 AM
To: [EMAIL PROTECTED]
Subject: [Templates] Swapping places in hash

Hello,

I know there are many tricks in TT that make life much easier, but is
there a decent way to change order of keys in hash? It seems to me that
perl doesn't care how I add these values to hash and it prints them out
in
weird order too.

Here's how the hash gets printed:

%hash = {
   'oigus' => 'foo',
   'pohipakett' => 'foo2',
   'reisitorge' => 'bar',
   'pagas' => 'asd',
}

But I need that 'pohipakett' is first, how can I do this?

Rgds,
Viljo


_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://www.template-toolkit.org/mailman/listinfo/templates



Reply via email to