phpperlhtmlspecialchars

How to convert special html characters in Perl?


In PHP it's as simple as htmlspecialchars, how to do it in Perl?


Solution

  • Use the HTML::Entities module.

    use HTML::Entities;
    
    my $input = "<em>TEST</em>";
    print(encode_entities($input));