in reply to Re: Here documents in blocks
in thread Here documents in blocks
prior of perl 5.26 you can use some trick to indent heredocs: substitution
That only works for variable assignment. If the same trick is attempted with a print statement, Perl complains that we Can't modify print in substitution (s///).
print <<"HEREDOC" =~ s/^\s+//gm; # <- Doesn't work your text goes here HEREDOC
I guess it could just be followed by print $var; but that continues the theme of inelegant solutions. I am sure there is a 'nice' solution to this...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Here documents in blocks
by LanX (Saint) on Dec 19, 2020 at 19:15 UTC | |
|
Re^3: Here documents in blocks
by Discipulus (Canon) on Dec 19, 2020 at 17:07 UTC | |
by Bod (Parson) on Dec 19, 2020 at 17:11 UTC | |
by Discipulus (Canon) on Dec 19, 2020 at 17:21 UTC | |
by jo37 (Curate) on Dec 19, 2020 at 18:26 UTC |