[Templates] Sorting numerically?
Rafael Kitover
caelum@debian.org
Thu, 10 Aug 2000 13:48:22 -0700
Gratuitous [% PERL %] solution:
[% PERL %]
$stash->{order_number_sorted_keys} =
sort { $a <=> $b } keys %{$stash->{order_record}}
[% END %]
then:
[% FOREACH order_number = order_number_sorted_keys %]
...
HTH
On Thu, Aug 10, 2000 at 12:18:19PM -0700, Christopher Taranto wrote:
> Hi,
>
> Is there a way to sort through a hash using a numerical sort instead of the
> default ASCII?
>
> I've searched through the docs and Dejanews but have not found anything for
> numeric sorting
>
> [% FOREACH order_number = order_record.keys.sort { $a <=> $b } %]
>
> I also looked at the source but I wasnt clear on where the sorting is
> actually taking place.
>
> I am using Template Toolkit 1.07
>
> Thanks!
--
Do what thou wilt shall be the whole of the Law.
Love is the law, love under will.