This is more of a generic perl question than an HTML::Template quwstion,
but...

my @sorted_array = sort {$array[$a]->{color} cmp $array[$b]->{color} }
@array;


----- Original Message -----
From: "Thomas D." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 11, 2003 3:37 PM
Subject: [htmltmpl] Sorting array of hash references


> Hello,
>
> I read HTML::Template tutorial at
> http://html-template.sourceforge.net/article.html. Before displaying any
data,
> I
> need to produce an array of hash references like:
> [
>      { name => 'Apple',   color => 'Red',    shape => 'Round' },
>      { name => 'Orange',  color => 'Orange', shape => 'Round' },
> ]
>
> So after getting the array of hash references, is there a way to sort the
array
> by
> a hash key, eg. key "color"?
>
> Thanks a lot,
> Thomas
>
> ______________________________________________________________________
> Post your free ad now! http://personals.yahoo.ca
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Html-template-users mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/html-template-users
>
>




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to