On Mon, 13 Mar 2006, Kapoor, Nishikant wrote:

Is there a way I can continue to use the 'single' assignment, and
still achieve this objective?

You seem to have the right idea here:

#BUT, if I need to bold the 'search text', I need to iterate through the loop
my @loopData=();
foreach my $rec (@{$data}) {
 my %loopRow;
 $rec->{title} =~ s/(\b$searchText\b)/<b>$1<\/b>/ig;
 $loopRow{title} = $rec->{title};
 push @loopData, \%loopRow;
}
$template->param(myLoopVar => [EMAIL PROTECTED]);

If you're dying to do it in one statement I suppose you could do:

  $template->param(myLoopVar =>
    [ map { $_->{title} =~ s!\b($searchText)\b!<b>$1</b>!ig;
            $_ } @$data ]);

I don't exactly consider that an improvement, personally.

-sam


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to