Not libwww, but still.
In your original string, Perl is trying to interpolate the original $ - It
thinks it's a variable.
So, either escape it :-
$crud = "I need to make \$10,000 a month to support my crack habit!";
Or use single quotes :-
$crud = 'I need to make $10,000 a month to support my crack habit!';
Some reg-ex parsers will want the & escaped as well, but Perl seems ok in
this case.
Robert.
-----Original Message-----
From: Charles Harvey [mailto:[EMAIL PROTECTED]]
Sent: 31 August 2000 13:28
To: [EMAIL PROTECTED]
Subject: pattern match weirdness
OK, not libwww, but if anyone can help out here....
I need to replace $ in a string with $ so it doesn't blow up a
substandard xml parser.
Try this:
$crud = "I need to make $10,000 a month to support my crack habit!";
$crud =~ s/\$/$/g;
print $crud;
Weird? I think so...
Running on the mac or the pc it replaces $10 with nothing. On the indy it
terminates the string in some patterns and replaces $10 with nothing in
others...
I also tried using hexadecimal like so:
$crud =~ s/\$/&\x04336;/g;
It terminated the string at the $ also.
Any help is greatly appreciated!
--
Thank you
--------------------------------------
Charles Harvey
[EMAIL PROTECTED]
http://www.thesunnews.com
http://www.myrtlebeachonline.com
Work (843) 444-1773
Cell 843-222-0974
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
None are so old as those who have outlived enthusiasm.
--Henry David Thoreau