[thelist] Perl Question / Logic

Kevin lists at irubin.com
Sun Jan 12 13:18:01 CST 2003


Hello,

I have a list of keywords associated with links and would like to replace
each keywords with each respective link. For example:

keyword             link
======================
NFL                    http://www.nfl.com/
football                http://www.football.com/


The original string

$string = qq{NFL football is a great sport};

Should become:

$string = qq{<a href="http://www.nfl.com/">NFL</a> <a
href="http://www.football.com/">football</a> is a great sport};


The keyword index will be dyanmic (reside in the db). Is there a nice and
elegant to this or is =~ s/ for each keyterm the only way to do this?

Thanks.
-K




More information about the thelist mailing list