faqts : Computers : Programming : Languages : Perl

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 14 people (43%) answered Yes
Recently 4 of 10 people (40%) answered Yes


How can I convert HTML Tags to < ?

Apr 18th, 2003 08:06
Colin Thomsen, joshue moises garcia sanchez, http://www.geocities.com/jmgs2000/perlrutinas.html#5

Only, add the text to a variable, then put these code :
$linktitle =~ s/</\</g;
$linkdescrip =~ s/</\</g;
Happy programming.
For more advanced tag conversion, done automatically, use the CGI perl 
module and the escapeHTML function as follows:
#!/usr/bin/perl -w
use CGI qw(:all);
$pre_text = "if (a > b) and (b < c) then print something";
$post_text = escapeHTML($pre_text);
print "$post_text\n";