On 31/10/12 00:19, Rajeev Prasad wrote:
hi Tom,

I just solved (found issue) with this.

I changed the way i was building the hash value: and then it worked fine.

$my_hash->{$index} = [$val1, $val2];

Also i looked and found nsort which resolved the other prob too.

but i have a new problem now. I am trying to break a long string (val2) on the first 
html break character (<br>) I am using this logic but it is not working. it 
seems my regex is wrong. i have tried many things. but it does not owrk. I get 
nothing for matches.1 can you suggest ?

     [% IF (matches = myhash.$index.1.match('(.*<br>)(.*$)')) %]
     <td><tt>[%- matches.0 -%]</tt><tt style="color:green;">[%- matches.1 
-%]</tt></td>
     [% ELSE %]
     <td><tt>[%- myhash.$index.1 -%]</tt></td>
     [% END %]



vmethods again, look for split.

perl -MTemplate -le'Template->new->process(\q{[% FOR section IN text.split("<br>") %]=> [% section _ "\n" %][% END %]}, { text => q{sample<br>text<br>here} })'

cheers,

Tom


_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to