here 文件

大型多線字串很難寫。

my $variable = <<'EOF';
this block of text is interpreted literally,
no \'quotes matter, they're just text
only the trailing left-aligned EOF matters.
EOF

注意:確保忽略堆疊溢位語法高亮顯示:這是非常錯誤的。

插值的 Heredocs 以同樣的方式工作。

my $variable = <<"I Want it to End";
this block of text is interpreted.
quotes\nare interpreted, and $interpolations
get interpolated... 
but still, left-aligned "I Want it to End" matters.
I Want it to End

在 5.26.0 *中待定是一個“縮排的 Heredoc”語法,它會為你修剪左邊的填充

Version >= 5.26.0

my $variable = <<~"MuchNicer";
    this block of text is interpreted.
    quotes\nare interpreted, and $interpolations
    get interpolated... 
    but still, left-aligned "I Want it to End" matters.
MuchNicer