Forum: Ruby I want to turn off backslashing of quotes and such from the

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2007-06-11 06:47
(Received via mailing list)
I do something like:
result=`cat mess.html`
p result

and all my quotes in my html file are suddenly backslashed.  Is there
any way
to turn that off?

xc
Nobuyoshi N. (Guest)
on 2007-06-11 08:51
(Received via mailing list)
Hi,

At Mon, 11 Jun 2007 11:47:01 +0900,
<removed_email_address@domain.invalid> wrote in [ruby-talk:255079]:
> result=`cat mess.html`
  puts result
Anthony M. (Guest)
on 2007-06-11 11:08
(Received via mailing list)
On Mon, Jun 11, 2007 at 01:51:16PM +0900, Nobuyoshi N. wrote:
> Hi,
>
> At Mon, 11 Jun 2007 11:47:01 +0900,
> <removed_email_address@domain.invalid> wrote in [ruby-talk:255079]:
> > result=`cat mess.html`
>   puts result

Or

print result

if you don't want an extra newline appended.
Xeno C. (Guest)
on 2007-06-12 06:38
(Received via mailing list)
Anthony M. wrote:
> On Mon, Jun 11, 2007 at 01:51:16PM +0900, Nobuyoshi N. wrote:
>> Hi,
>>
>> At Mon, 11 Jun 2007 11:47:01 +0900,
>> <removed_email_address@domain.invalid> wrote in [ruby-talk:255079]:
>>> result=`cat mess.html`

Yeah, looks like I only get the backslashes inserted when I use "p"
instead of puts and print.  Thanks.
Gregory B. (Guest)
on 2007-06-12 06:42
(Received via mailing list)
On 6/11/07, Xeno C. <removed_email_address@domain.invalid> wrote:
> Anthony M. wrote:
> > On Mon, Jun 11, 2007 at 01:51:16PM +0900, Nobuyoshi N. wrote:
> >> Hi,
> >>
> >> At Mon, 11 Jun 2007 11:47:01 +0900,
> >> <removed_email_address@domain.invalid> wrote in [ruby-talk:255079]:
> >>> result=`cat mess.html`
>
> Yeah, looks like I only get the backslashes inserted when I use "p"
> instead of puts and print.  Thanks.

That's a feature.

seltzer:~/devel/bazaar/EarGTD sandal$ irb
>> a = "foo
oo"
=> "foo\noo"
>> puts a
foo
oo

p looks for the .inspect output, wheras puts uses .to_s
useful for debugging.
This topic is locked and can not be replied to.