use HTML::Entities; use HTML::Entities qw( %char2entity %entity2char ); #thanks ikegami foreach $val (keys %char2entity) { print "
$val => $char2entity{$val}\n"; } $string = "this is an @ AT"; $string_2 = "é â ä à å ç ê ë è ï î ì Ä å É æ Æ ô ö ò û ù ÿ Ö Ü £ ¥ P ƒ á í ó ú ñ Ñ ª º ¿ ¬ ¬ ½ ¼ ¡ @ . , < > [ ] { } - _ ; :"; print "

encoded @ => ".encode_entities('@').",
and the string has become => ".encode_entities($string)."
and the string_2 has become => ".encode_entities($string_2)."\n";