in reply to Re^2: Template toolkit Adding Values to Variable
in thread Template toolkit Adding Values to Variable

Where did you get this idea from?

it works with a hash just like it works with arrays

Anyway I have tried it and it works fine for me.

[% totalprice = 900 %] [% FOREACH x IN shopping %] [% modelname = x.key %][% information = x.value %] [% MAKE_NAME = information.MAKE %] Quantity: [% information.QTY %] x [% information.PRICE %]<br/> [% ff = information.PRICE * information.QTY %] PRICE = [% ff %]<br/> [% totalprice = totalprice + ff %] [% totalprice %]#print out 1000 <hr/> [% END %] [% totalprice %]<----- 3 -------->

It prints out 1000 as the final number not 900

Replies are listed 'Best First'.
Re^4: Template toolkit Adding Values to Variable
by seekperlwisdom (Acolyte) on Mar 02, 2010 at 22:40 UTC

    Thank you very much, it has solved all the problem, where as the hash and array are concerned i was just following the book and thinking accordingly. but again thanks for help me out.