[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] TerminatorString



At 8:33 -0500 8/24/99, Jefferson R. Lowrey wrote:
>At 10:34 PM +1000 8/24/99, Peta Adams - John Murray wrote:
>>Running of A giving B. What can't I see?
>>
>>B. # Can't find string terminator "HTML" anywhere before EOF.
>>File 'Hard Disk:Desktop Folder:AMP WEB DB:lsinitemtest'; Line 11
>>
>>A. #############
>>#! perl -w
>>
>>open (INVITS, '<Hard Disk:Desktop Folder:AMP WEB DB:invitems.txt') or die
>>('Problem with open of invitems.txt');
>>print <<'HTML';
>>... some stuff to print ...
>>HTML
>>while (defined ($readline = <INVITS>)){
>>	chomp $readline;
>>	$readline =~ s/~~~/<br>/g;
>>	@rec = split (/:::/,$readline);
>>	print <<"HTML";
>>	... some stuff to print ...
>>	HTML
>>}
>>print <<'HTML';
>>... some stuff to print ...
>>HTML
>>############
>
>Per your previous question, you have to move the first HTML all the way to
>the left margin.
>
>You can't have any leading spaces before the terminating string of a here doc.
>
>-Jeff Lowrey

Another "gotcha" is that the terminating string can't have trailing
whitespace, either.  It has to be *alone* on the line.

This hack works (but remember to adjust it if the block's indentation
changes, and to indent the terminating string with spaces or use the right
number of tabs in the print statement's white space before the visible
string <you need an exact match>):

    print <<"    HTML";
    "This is a test."
    HTML

Above assertions tested with
This is perl, version 5.004_04 built for i386-bsdos

  --John
-- 
John Baxter   jwblist@olympus.net      Port Ludlow, WA, USA

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org