newatperl has asked for the wisdom of the Perl Monks concerning the following question:

When I try to run
print <<EOM; <p>something <p>more of something EOM
I get the error that the server cannot find EOM before end of file... even when I comment the stuff out in between, I still get this error. Furthermore, the error almost seems to come and go. It'll be working just fine and I'll be working on code far away from it, and all of a sudden, bam... it stops working... Any ideas anyone? I'm dying here!!! Thanks

Replies are listed 'Best First'.
Re: help help!! simple bug
by dws (Chancellor) on May 09, 2001 at 10:59 UTC
    I get the error that the server cannot find EOM before end of file.

    Make sure you have no whitespace before or after the EOM, and make sure that there's a "\n" after the EOM.

    If you really, really want to indent the EOM, use

    { print <<' EOM'; ... whatever ... EOM }
Re: help help!! simple bug
by bjelli (Pilgrim) on May 09, 2001 at 11:58 UTC

    dws said it perfectly.

    A good habit to ensure that there is a "\n" at the end of EOM, even if it's the last line in the program: Always add a comment at the end of the program, like so:

    print <<EOM; <p>something <p>more of something EOM # that's all.

    My text editor on windows never writes a line-break after the last line - took me ages to find that out.

    --
    Brigitte    'I never met a chocolate I didnt like'    Jellinek
    http://www.horus.com/~bjelli/         http://perlwelt.horus.at
Re: help help!! simple bug
by SageMusings (Beadle) on May 09, 2001 at 21:04 UTC
    YES!,
    I had the same problem a while back. It caused me much grief. The answer, at least for me, was to ignore the identation levels I had set up in my source. That is put EOM on a line by itself at column #1. Viola!, no more errors.

    True, it looks like a hiccup in the flow of your elegantly laid out code, but I always include a comment above it explaining its rude appearance.

    Hope this helps you.