[Templates] Lists and rand like http://faq.perl.org/perlfaq4. html#How_do_I_select_a_ra

Paul Seamons mail@seamons.com
Tue, 18 Jul 2006 13:56:54 -0600


> [% tips.${Math.rand(tips.size)} %]

That will work only if Math.rand returns an integer value.  You can only 
subscript arrays in TT2 with integers.  CGI::Ex::Template doesn't have this 
restriction (I think TT3 won't either - but I'm not sure).

> Remind me, do the ${} force scalar context?

No they don't.  All method calls on objects are in list context.

Paul