SPUG:Here documents

Jonathan Gardner jgardn at alumni.washington.edu
Fri May 2 15:01:49 CDT 2003


On Friday 02 May 2003 12:30, David Dyck wrote:
> On Fri, 2 May 2003 at 12:06 -0700, Brian Hatch <spug at ifokr.org> wrote:
> > Is there any way to allow a HERE document delimiter to be indented?  Ala
> > 		 ....
> > Instead of having EOM at position 0 on the line?
>
> The perl FAQ states:
>
>                But the HERE_TARGET must still be flush against
>                the margin.  If you want that indented also,
>                you'll have to quote in the indentation.
>
>                    ($quote = <<'    FINIS') =~ s/^\s+//gm;
>
> but that isn't quite what you want.
>
> There might be some way to do it using source filters, either
>  Filter::Simple
> or
>  Filter::Util::Call
>

I think this can be summed up as "No". ;-)

If you are having trouble distinguishing between here docs and code, use a 
nice text editor that has syntax highlighting that recognizes the difference. 
This way, your here doc will appear as if it was quoted.

I suggest ViM (http://www.vim.org) as it is cross-platform in a very strong 
sense of the word, and easy to use (but not necessarily easy to *learn*). I 
know several people who use Emacs and other editors that have the same 
ability to do syntax highlighting in that way.

-- 
Jonathan Gardner <jgardner at jonathangardner.net>
(was jgardn at alumni.washington.edu)
Live Free, Use Linux!



More information about the spug-list mailing list