Here document works in a similar way, except that the delimiter can be many characters long.
x = <<END_MY_STRING_PLEASE This is the string And a second line # www .ja v a 2 s . co m END_MY_STRING_PLEASE puts x
Here, << marks the start of the string literal and is followed by a delimiter of your choice.
We used END_MY_STRING_PLEASE.
The string literal then starts from the next new line and finishes when the delimiter is repeated again on a line on its own.