Michael G Schwern wrote:
>
> > print <<END_OF_DOC =~ s/^\s{0,5}//g;
>
> This still leaves the problem of having to count whitespace and having
> to change your regex if you reindent your code. In effect, it causes
> whitespace to become significant. Bleh.
How is this different from having to count the number of spaces you
reindent your here doc terminator?
print <<EOF;
We want a total of
3 leading spaces stripped off
EOF
print <<EOF;
Now we want a total of
5 leading spaces stripped
EOF
As was already discussed, this approach is quite fragile; I think the
consensus was trying to get away from this.
Plus regex's are more general; they can strip leading funny chars as
well:
print <<EOF =~ s/^\s*\|*\s{0,5}//g;
| I like to use the bar symbol to
| logically partition off my here docs
EOF
Anyways, there was a sizeable discussion on this already, here are some
of the points discussed:
http://www.mail-archive.com/perl6-language@perl.org/msg02556.html
http://www.mail-archive.com/perl6-language@perl.org/msg03034.html
http://www.mail-archive.com/perl6-language@perl.org/msg03035.html
http://www.mail-archive.com/perl6-language@perl.org/msg03037.html
http://www.mail-archive.com/perl6-language@perl.org/msg03048.html
http://www.mail-archive.com/perl6-language@perl.org/msg03041.html
Not trying to cut your points off at the knees, but many of them were
discussed already and I think the conclusions make sense.
-Nate