Joshua Scott wrote: > 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 > ---- > > 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?
Hi Joshua. Take a step or two back. What do you want to use your database field for? the '\n' character pair within a string is useless for most things other than putting into an 'eval' call in a Perl script. Also, you say that you want it to look "exactly as it is stored in the variable". What is stored in the variable for "\n" is the control character 0x0A (ASCII LF) , and certainly not the two characters '\n'. If you let us know the problem you're trying to solve maybe we can help further? Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]