List Info

Thread: Push a list




Push a list
user name
2006-01-31 21:48:13
LIST_OPS has:

  'push'    => sub { my $list = shift; push($list,
shift); return '' },

How about this instead?

  'push'    => sub { my $list = shift; push($list,
_);
return '' },


    foo.push( 'one', 'two', 'three' );



Any way to do anonymous join? ;)

    ['one', 'two', 'three'].join('+');



-- 
Bill Moseley
moseleyhank.org


_______________________________________________
templates mailing list
templatestemplate-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/t
emplates
Push a list
user name
2006-02-01 07:48:26
Bill Moseley wrote:
>   'push'    => sub { my $list = shift; push($list,
_);
return '' },

Good idea.  I guess it should have been like that all along.
 Thanks.
I've done the same for unshift, too.

> Any way to do anonymous join? ;)
>
>     ['one', 'two', 'three'].join('+');

Not until TT3 :-(


http://template-toolkit.org/bond.pm/tt3/literal.html

A


_______________________________________________
templates mailing list
templatestemplate-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/t
emplates
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )