Andy Wardley wrote: >Perhaps the best solution is to have a '.size' method which works >consistently >across all data types: > > [% item.size %] # 1 > [% hash.size %] # scalar(keys %$hash) > [% list.size %] # scalar(@$list) On Fri, Jan 25, 2002 at 12:38:25PM -0500, darren chamberlain wrote: > How about: > > $Template::Stash::SCALAR_OPS->{ size } = <same as length>
Yep, that's what I've gone for. 'size' returns length of a scalar, number of elements in a list, or number of key => value pairs in a hash. To be appearing in a new developer release near you Real Soon Now... A