print XML::LibXML::Text->new('<&')->toString; #### sub escape_xml { XML::LibXML::Text->new(shift)->toString } print escape_xml('<&');