in reply to Re^2: How to modify an attribute containing special characters in a xml file?
in thread How to modify an attribute containing special characters in a xml file?

You will need to learn about ampersand-encoding and XML then. I guess that 
 is already encoded and the 
 stands for the character \x0A in Perl parlance. So you will need to change your initial string to:

my $string="Johnson Controls Automotive Electronics\x0APackage: GMLAN +3.1 - Single Channel\x0AMicro: uPD70F3524\x0ACompiler: Green Hills 5. +1.7-BD1110030";

or, in a more sensible fashion:

my $string= join "\n", "Johnson Controls Automotive Electronics", "Package: GMLAN 3.1 - Single Channel", "Micro: uPD70F3524", "Compiler: Green Hills 5.1.7-BD1110030";

I guess that the original text contains line breaks and you want to preserve them.

Replies are listed 'Best First'.
Re^4: How to modify an attribute containing special characters in a xml file?
by ankit.tayal560 (Beadle) on Sep 30, 2016 at 12:09 UTC

    Hi Corion, Thanks a lot ! I was scratching my head on that problem for so long. your solution works perfectly.