[Catalyst] Re: difficulty in assigning an array to a stash

A. Pagaltzis pagaltzis at gmx.de
Mon Nov 12 20:03:25 GMT 2007


* Carl Johnstone <catalyst at fadetoblack.me.uk> [2007-11-12 12:10]:
> jagdish eashwar wrote:
>> I am getting only the last value in the tt2 template. 
> You're actually getting the number of items in the list,
> because that's what you get when you turn a list into a single
> value.

No, that’s what you get from an array in scalar context. Lists
and arrays are not the same.

    $ perl -le'@_=("a"..."z"); print $_=@_; print $_=@_[0..$#_]'
    26
    z

(I didn’t just say `$_=("a".."z")` because that puts the
right-hand side in scalar context, where the `..` operator is
a flip-flop, not a range.)

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list