Skip to content

Commit c81cb65

Browse files
authored
add example of an interpolating heredoc
1 parent 0022a87 commit c81cb65

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

doc/Language/quoting.pod6

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,23 @@ some multi line
340340
341341
Heredocs include the newline from before the terminator.
342342
343+
To allow interpolation of variable use the C<qq> form, but you will then have to escape some meta characters such as
344+
C<{}$"'> and others. For example:
345+
346+
my $f = 'db.7.3.8';
347+
my $s = qq:to/END/;
348+
option \{
349+
file \"$f\";
350+
\};
351+
END
352+
say $s;
353+
354+
would produce:
355+
356+
option {
357+
file "db.7.3.8";
358+
};
359+
343360
=head1 Regexes
344361
345362
For information about quoting as applied in regexes see the L<regular

0 commit comments

Comments
 (0)