in reply to else statement

From your supplied code fragment, I think the unexpected end of file is because there is no EOL to tell the program to stop printing before it reaches the end of the file.

Here-docs are discussed way down (search for <<EOF) in the perlop perldoc page here.

How can you feel when you're made of steel? I am made of steel. I am the Robot Tourist.
Robot Tourist, by Ten Benson