Continuing its quest to clean up long deprecated features, v5.28 takes care of another feature deprecated since v5.0. You can no longer neglect to specify a heredoc separator. This was a warning in v5.26 and is now fatal. You probably weren’t doing this anyway (I’ve never seen it in the wild), but it’s nice to know the edge cases are disappearing.
Usually, you give a heredoc some string that marks its end. The quotes around that terminator string denote the type of string it is. This one is a double-quoted string:
my $position = "first"; print <<"HERE"; This is the $position line This is a different line This is the last line HERE
With no quoting, it’s still a double-quoted string:
my $position = "first"; print <<HERE; This is the $position line This is a different line This is the last line HERE
With v5.26, you can indent the heredoc. This gives the same output:
my $position = "first"; print <<~"HERE"; This is the $position line This is a different line This is the last line HERE
Single quotes around the delimiter string make for a single-quoted string:
print <<'HERE'; This is the first line This is a different line This is the last line HERE
You can even use the empty string (single- or double-quoted), which is probably a bad idea for future maintainers:
print <<''; This is the first line This is a different line This is the last line print "New statement!";
Prior to v5.26, you could leave off the quotes and the delimiter string:
print <<; This is the first line This is a different line This is the last line print "New statement!";
Starting with v5.26, that still works but gives a warning:
Use of bare << to mean <<"" is deprecated. Its use will be fatal in Perl 5.28
Now, with v5.28, it's fatal:
Use of bare << to mean <<"" is forbidden