I am new to Perl.
I am trying to duplicate some/most of the functionality of PHP's htmlentities()
So far I have this:
$str = '" \' < >';
$str = join('<', split('<', $str));
$str = join('>', split('>', $str));
$str = join('"', split('"', $str));
$str = join(''', split("'", $str));
print $str;
It is working for my needs but the micro-optimizer in me just feels like there must be a better way.
I am terrible with regex and so many Perl tutorials deal with custom or non-standard libraries or it just seems this way due to my inexperience.
perl -v
produces:
v5.10.1