I assume there must be a usual way to do this, but it wasn't
clear from the parts of the Manual I've been looking at.
I have something I'm converting to TT from a CGI.pm-based
system. Part of it involves taking text that has been
searched by a search engine, and highlighting the search
word that has been found. I had been doing it more or
less like this:
---
my $image = "<img src=\"\/images/ball.red.small.gif\">";
my $search_word = "foo"; # populated somehow
my $text = "Here I want foo highlighted."; # also populated somehow
$text =~ s/($search_word)/$image$1/ig; # now $text is:
# Here I want <img src="/images/ball.red.small.gif">foo highlighted.
---
What's the more TT-ly way of doing this?
Thank you.
Jesse Sheidlower
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates