----- Original Message ----- 
From: "Stout, Joel R" <[EMAIL PROTECTED]>
To: "John" <[EMAIL PROTECTED]>; "Perl Beginners" <beginners@perl.org>
Sent: Thursday, February 03, 2005 8:17 PM
Subject: RE: replacing special chars


> Try this, and remember - with XML there are more than one you have to
> change:
> 
> sub xc {
> #returns text free of XML baddies - xc = xml clean
> my $data = $_[0];
> $data =~ s/&/&amp;/g;
> $data =~ s/</&lt;/g;
> $data =~ s/>/&gt;/g;
>         $data =~ s/'/&apos;/g;
> $data =~ s/"/&quot;/g;
> return $data;
> } 
> 
> -----Original Message-----
> From: John [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, February 03, 2005 9:36 AM
> To: Perl Beginners
> Subject: replacing special chars
> 
> Hello to all
> 
> I want to replace the & with the &amp;
> 
> I use the command s/\&/\&amp;/; with no luck
> 
> Does anybody know what am i missing here?
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 
> 
> 

Well, i have put the <![CDATA[ "my strings here" ]]>
And it work perfectly.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to