This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Whitespace and Here Docs =head1 VERSION Maintainer: Richard Proctor <[EMAIL PROTECTED]> Date: 16 Aug 2000 Version: 1 Mailing List: [EMAIL PROTECTED] Number: 111 =head1 ABSTRACT With a here doc print <<ZZZ; the ZZZ has to be at the start of a line and the text of the here doc, is processed verbatum. This results in Here Docs that either stick out in the code, or result in unwanted leading whitespace. There are several FAQs that relate to this problem. This proposal tidies this up. =head1 DESCRIPTION Suggested syntax: print <<<xxx, <<<"xxx", print <<<'yyy', or print <<<`zzz`. I had earlier proposed an alternitive syntax "print <<'zzz'/x", but that above was the "prefered" option when this was originally discussed on p5p. This will ignore all leading white space on each line until the end terminator is found. It effectively does s/^\s*// before processing each following line. It also ignores whitespace (but not the line termination) after the terminator. Personally I find such blocks very usefull for cgi programming, when delivering large blocks of fixed html. Thus these are equivalent: print <<ZZZ; This is what is wanted but it sticks out in the code, and I have to remember to put the ZZZ at the begining of the line, and be carefull about whitespace after the ZZZ. ZZZ print <<<ZZZ; This is what is wanted, it will be printed without this leading space and the terminator ZZZ is recogised even if there is a space after it. ZZZ Except that the last case does not stickout and the ZZZ can be embeded nicely. (Note I am only on the announce list at present as I am suffering from negative free time). =head1 IMPLENTATION This should be a relatively simple addition to perl (I think just to scan_heredoc in toke.c + docs in perl5) =head1 REFERENCES This was discussed on p5p a year ago and I partially implemented it but ran out of free time.
