Skip to content

Commit 9c955b1

Browse files
authored
In quoting.rakudoc, add note how newline after Heredocs can be removed via chomp (#4656)
1 parent c8bc721 commit 9c955b1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

doc/Language/quoting.rakudoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,14 @@ some multi line
562562
=end code
563563

564564
I<Heredocs> include the newline from before the terminator.
565+
A common idiom to remove it is to put a L<C<chomp>|/type/Str#routine_chomp> at the beginning, for example:
566+
567+
=begin code
568+
my $s = chomp q:to/END/;
569+
The result will have
570+
no final newline.
571+
END
572+
=end code
565573

566574
To allow interpolation of variables use the C<qq> form, but you will then have
567575
to escape metacharacters C<\{> as well as C<$> if it is not the sigil for a

0 commit comments

Comments
 (0)