On Tuesday, September 30, 2003 at 16:00, Dave Cash wrote:
> On Tue, 30 Sep 2003, Tony Bowden wrote:
> I don't know of any idiom use native TT2 virtual methods
A simple hash.sort should do the trick, like so
[%- hash = { '1' => 'Camille',
'2' => 'Andrew',
'3' => 'Lili',
'4' => 'Isidore' } %]
[%- FOREACH key = hash.sort %]
[%- key %] = [% hash.$key %]
[% END %]
It is defined similarly to the way you did (but converts the values to
lower-case before comparing):
'sort' => sub {
my ($hash) = @_;
[ sort { lc $hash->{$a} cmp lc $hash->{$b} } (keys %$hash) ];
},
Best regards,
Axel
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates