http://qs321.pair.com?node_id=186055

peacemaker1820 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks.
I have a database of customers and their addresses. Some of the words in my address fields in the database contain apostrophe '.
Now, when i get the address field , i pass it to javascript method for some more work. here is part of the code:
# Fetch row my ( $custno, $companyName, $address, $city, $state, $zip) = $SQL->fet +chrow_array(); print <<EndHTML; <script language="javascript"> fillCustomer('$custno', '$companyName', '$address', '$city', '$state', + '$zip'); </script> EndHTML
my problem is that it gives me a runtime error when ever my address record contains an apostrophe character ('). My idea is that somehow i need to add an escape character in that record before the apostrophe, but i do not want to do that.
Any other ideas, guys?
Greatly appreciated.