HTMLエスケープ
HTML::Entitiesを使うと簡単です。
use strict; use warnings; use HTML::Entities; my $data = '<span id="item">data</span>'; my $safe = encode_entities($data, q{&<>"'}); my $text = decode_entities($data, q{&<>"'}); print $safe, "\n"; print $text, "\n";