Alle Saturday 22 November 2008, Kelly Jones ha scritto:
> Perl lets you quote strings like this:
>
> $foo = qq%This string has both "quotes" and 'apostrophes'%;
>
> to avoid excessive backslashing.
>
> Does ruby have anything similar?

Yes: 

%Q["abc 'def]

and

%["abc 'def]

create a string which can contain string interpolation:

%Q[{1+1}]
=> "2"

%q["abc 'def]

creates a string without string interpolation:

%q[#{1+1}]
=> "#{1+1}"

You can replace the [] with (), {} or <> or with any non alphanumeric 
character (that is any character excluding letters and digits):

%q{"abc"}
%q!abc!

I hope this helps

Stefano