in reply to HTML code escaped from web page on browser

You could use "encode_entities" from HTML::Entities which is explicitly designed for this, or,
from the CGI module, use:
$escaped_string = escapeHTML("<unescaped> string"); #Escape HTML formatting characters in a string.

        This is not an optical illusion, it just looks like one.