user
A   *here document*   (or "heredoc")   is a way of specifying a text block, preserving the line breaks, indentation and other whitespace within the text.

Depending on the language being used, a   *here document*   is constructed using a command followed by "<<" (or some other symbol) followed by a token string.

The text block will then start on the next line, and will be followed by the chosen token at the beginning of the following line, which is used to mark the end of the text block.

Task

Demonstrate the use of   *here documents*   within the language.

Related task

* Documentation
assistant
(formerly Perl 6)
Heredocs in Raku use the `:to` modifier to a quoting operator,
such as `q` or `qq`.
The indentation of the end marker is removed from every line.

```
my $color = 'green';
say qq :to 'END';
    some line
    color: $color
    another line
    END

```

Output:

```
some line
color: green
another line

```

Note that the quotes around the "END" are not magic --- the marker is just a regular string; it's the `q` or `qq` that decides whether or not the heredoc interpolates.

Multiple here docs may be stacked on top of each other.

```
my $contrived_example = 'Dylan';
sub freewheelin() {
        print q :to 'QUOTE', '-- ', qq :to 'AUTHOR';
          I'll let you be in my dream,
            if I can be in yours.
        QUOTE
                Bob $contrived_example
                AUTHOR
}

freewheelin;

```

Output:

```
  I'll let you be in my dream,
    if I can be in yours.
-- Bob Dylan

```

Both q and qq are specialised forms of Q which comes with many adverbs. Here a heredoc that only interpolates @-sigils.

```
my @a = <1 2 3 4>;
say Q :array :to 'EOH';
    123 \n '"`
        @a$bc
        @a[]
    EOH

```

Output:

```
123 \n '"`
    @a$bc
    1 2 3 4
```