in reply to creating an XML string

change "IBM & Microsoft" into "IBM & Microsoft"?
i assume you mean change "IBM & Microsoft" into "IBM & Microsoft", or even &.

if you know the codes of the chars you want to change, you can do something like the following:
my %ent= ( "&" => 38, "<" => 60, ">" => 62, #... ); $string = "IBM & Microsoft > Sun\n"; print $string; for ( keys %ent ) { $string =~ s/$_/&#$ent{$_};/g } print $string; #prints IBM &#38; Microsoft &#62; Sun
Another option is to put the string in question into a <![CDATA[...]]>-section.

Replies are listed 'Best First'.
Re^2: creating an XML string
by holli (Abbot) on Dec 28, 2004 at 18:19 UTC
    damn. too slow ;-)