OAS OAS - 5 months ago 8
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.

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

print "aaa <bbb> ccc";


displays

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

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.

Comments