# Perl 5.26 added <<~ too, with a different rule: it removes exactly the
# indentation of the closing word, and a line indented less is an error.
use strict;
use warnings;

sub show {
    my ($title, $text) = @_;
    print "$title\n";
    print "  |$_|\n" for split /\n/, $text;
    print "\n";
}

my $id = 7;
show("<<~SQL, lines indented 6, 8 and 7, closing word indented 4:", <<~SQL);
      SELECT name
        FROM users
       WHERE id = $id
    SQL

my $ok = eval "my \$short = <<~EOT;\n  SELECT name\n    EOT\n1";
(my $error = $@) =~ s/ at \(eval \d+\).*//s;
print "a line indented 2 above a closing word indented 4:\n  ", ($ok ? "accepted" : $error), "\n";
