Hello! I agree with Johan, as I also wasn't able to reproduce your issue. This is what I tried:
---------------8<--------------- use Template; Template->new->process(\*DATA, { data => { className => '42.55' } }); __END__ [% items = data.className.split('\.') %] [% items.last %] --------------->8--------------- This outputs "55", as you would expect. Cheers! On Sun, Aug 17, 2014 at 5:58 PM, Johan Vromans <jvrom...@squirrel.nl> wrote: > Jean-Michel Caricand <jean-michel.caric...@laposte.net> writes: > >> Hello, >> >> I have a little question with split. I want to split my string >> variable on "." >> >> Example : >> >> >> data.className contents = "A.b.C"; >> >> [% BLOCK viewController %] >> [% items = data.className.split('\.'); >> %] >> >> [% items.last %] >> >> That doesn't work. With Perl, I can use this : >> >> @items = split(/\./, data->{className}); >> >> but that doesn't work with TT2. >> >> Any idea ? > > This works: > > [% x = 'a.b.c'; x.split('\.').join('|') %] > > it outputs a|b|c > > Are you sure you did set the value of data.className correctly? > > -- Johan > > _______________________________________________ > templates mailing list > templates@template-toolkit.org > http://mail.template-toolkit.org/mailman/listinfo/templates _______________________________________________ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates