I'm not familiar with the DBI::quote method. I'll have to look that one up. However, I already solved my problem. The issue was with the ',\,\n,$ and @ characters. All I did was add a backslash to the front of each of these characters and voila...my script ran perfectly.
Thanks anyways for the assistance! Joshua Scott Security Architect, CISSP Jacobs Engineering -----Original Message----- From: Janek Schleicher [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 02, 2003 7:29 PM To: [EMAIL PROTECTED] Subject: Re: Newlines, control characters, etc Joshua Scott wrote at Wed, 02 Jul 2003 21:25:34 -0400: > I'm trying to copy data from one database field to another. The > problem is that the field contains various newline and other types of > control characters. Whenever the script runs, it processes those as > perl code instead of data like I'd like it to. How can I prevent it > from doing this? > > > Here is an example of what is happening. > > $variable = "Some data\nSome more data\n\nBlah Blah" > > This variable was populated from an SQL table. I'm trying to create a > valid SQL scripts file so I do the following. > > print FILE "INSERT into table (field) VALUES ('$variable');" > > The file gets created just fine, but when I view the file it looks > like > this: > > ---- > INSERT into table (field) VALUES ('Some Data > Some more data > > Blah Blah If the string ends with a ' it is a full valid SQL script. > Basically, I'd like it to look exactly as it is stored in the > variable...which would be like this: > > ---- > INSERT into table (field) VALUES ('Some data\nSome more > data\n\nBlah Blah"; > ---- > What do I need to do? You can do something like $variable =~ s/\n/\\n/gs; To say the truth, I would be more scared of e.g. ' contained in the string. Such stuff, I would prefer to quote with the DBI::quote method. Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ============================================================================== NOTICE - This communication may contain confidential and privileged information that is for the sole use of the intended recipient. Any viewing, copying or distribution of, or reliance on this message by unintended recipients is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. ==============================================================================