in reply to Re^2: xml::libxml open, add and save not formatting properly
in thread xml::libxml open, add and save not formatting properly

Instead of
sub text_to_xml { my $s = shift; $s =~ s/]]>/]]>]]&gt;<![CDATA[/g; return "<![CDATA[$xml]]>"; }
you could use
use HTML::Entities qw( encode_entities ); sub text_to_xml { return encode_entities($text, '<&'); }