OAS OAS - 1 year ago 42
Perl Question

Trouble with printing <bbb>-constructs in perl

I have a small perl script that I would like to print a file containing text. So far, so god, however, the file contains some text enclosed with < and >, ie.

. The problem is that the
are removed. The same happens when I do a simple print statement like this:

print "aaa <bbb> ccc";


aaa ccc

I have searched around, but not been able to find the solution. Amongst others, I have found this Printing string in Perl, but can't really see how the answer applies?

mob mob
Answer Source

Are you displaying the output in a web browser? Then try

print "aaa &lt;bbb&gt; ccc";

and see the HTML::Entities module if you'll need to make conversions like this on other lines of text.