Michael G Schwern wrote:
> 
> No, it still has all the problems of any other regex-based solution.
> If you shift the code right or left, it breaks (due to the \s{8}) and
> you're back to counting whitespace again.

Y'know, I pointed out before why I think this is a superfluous issue.
You have to either change your regexp, or change the indentation of your
here docs terminator when you move your code around. And counting
whitespace is not so hard to justify breaking this:

    if ( $its_all_good ) {
         print <<EOF;
             Thank goodness this text is centered!
                  I'd really hate for it to
                       left-shift on me.
         EOF
    }

This should print out the text as shown verbatim. If you want
reformatting of any kind, that's what regex's are for. The above is far
more flexible, and your problem already has several other solutions,
which you have yourself noted.

Plus how to address the whole can of worms with tabs -> spaces, 4 or 8,
trailing too, blank line stripping? Blech. regex.

> And as Glen pointed out, what about that leading newline?

Handled by the regexp, actually (yep I tested it).

> Can I scream now?

Not yet, but I might! :-)

-Nate

Reply via email to