On Tue, 11 Feb 2003 20:41:41 +0100, Tim Kynerd wrote:

> Hi everyone,
> 
> Am having MAJOR trouble handling strings.
> 
> I have a file into which I've put some text. I want to read this text into
> some data structures and, later, print it out.
> 
> All the related text is on a single line, but one of the text items
> contains embedded newlines, which I've entered into the file as "\n". The
> portions of each line (record) are tab-separated to make them easier to
> read.
> 
> No problems reading the file and doing everything else the way I want to,
> and I end up with the string I intend to print out (that contains the
> embedded newlines). BUT: no matter what I do, I can't get either puts or
> print to substitute newlines for the "\n" sequences. Both methods just
> print them out as is. Not good.
> 
> I've tried several ways of quoting ("#{variable}", %Q(#{variable}), etc.)
> with zero success. ("variable" in both cases is a String object.)
> 
> Any suggestions?

Sorry for the follow-up to myself, but: Using the debugger makes it clear
that gets is escaping my backslashes, resulting in the sequence "\\n" in
my data. This is NOT desirable.

Is there any way to control (read: quash) this behavior?

-- 
Tim Kynerd   Sundbyberg (sméÔtan i storstan), Sweden   tim / tram.nu
Sunrise in Stockholm today:  7:42
Sunset in Stockholm today:  16:21
My rail transit photos at http://www.kynerd.nu