$ perl -MHTML::Entities -e'print encode_entities(q(I have a 15" latter and a 6" foot arm.))' I have a 15" latter and a 6" foot arm.$ #### use HTML::Entities; my $str = q("I have a 15" latter and a 6" foot arm."); my $re = qr/^("?)(.*?)("?)$/s; $str =~ s/$re/$1.encode_entities($2).$3/e; print $str, $/; __END__ "I have a 15" latter and a 6" foot arm." #### use HTML::Entities; my $str = q("I have a 15" latter and a 6" foot arm."); substr($str, 1, -1) = encode_entities substr($str, 1, -1), q("); print $str, $/; __END__ "I have a 15" latter and a 6" foot arm."