I am looking for perl equivalent of PHP functions htmlspecialchars()
and stripslashes() to parse a html page. Any pointers will be of
great help.
Regards,
-Yogesh
There are lots of ways to do it, try the HTML::Entities module:
http://search.cpan.org/~gaas/HTML-Parser-3.56/lib/HTML/Entities.pm
> and stripslashes() to parse a html page.
stripslashes seems to be something like
s/\\//g;
in Perl.
That would be CGI.pm's escapeHTML() function.
> and stripslashes()
Don't know about any function. I'd make use of the s/// operator.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Thanks Ben for your input. HTML::Entities seems to solve my
puzzle. :)
will use Regex for stripslashes. Thanks again.
>> stripslashesseems to be something like
>>
>> s/\\//g;
> will use Regex for stripslashes. Thanks again.
Transliteration is more appropriate for operating on characters
(regexes are better for operating on patterns):
tr/\\//d;
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
True, but are we really talking about simple character removals here? I
thought we were rather talking about something like
s/(^|[^\\])\\(['"\\0])/$1.($2 eq '0' ? "\0" : $2)/eg
http://www.php.net/manual/en/function.stripslashes.php
> stripslashes seems to be something like
>
> s/\\//g;
>
> in Perl.
I find it funny that it removes backslashes and not is called
stripbackslashes.
--
Affijn, Ruud
"Gewoon is een tijger."
The name in perlop is "leaning toothpick syndrome".
--S
** Posted from http://www.teranews.com **