[EMAIL PROTECTED] wrote:

lnatz wrote:

Hi, I'm having an issue with here docs, and I'm sure it's something
simple that I'm overlooking but it's annoying me. Here is a snippet
from my script.

sub usageAndDie {
print< < EOF;

>> The following single-character otions are accepted:
>> wih arguments: -T -S
>> without arguments(boolean): -g -e
>> Use:
>> -T followed by a target
>> -S followed by a source
>> -g to generate a runbook
>> -e to execute the runbook
>> Requirements:
>> you must specify a target and a source
>> you must specify either to generate a runbook, execute the runbook or both

>> Example: perl exec_rnbk.pl -T UT -S testing -g
EOF
exit 0;
}

Its failing with the error: Can't find string terminator "EOF"
anywhere before EOF at exec_rnbk.pl line 94.
Line 94 is "print< < EOF;".

Am I just missing something obvious here?

I think that Rob was onto something, here is my 2 cents.

The print line should be like this:

 print <<EOF

and not

print< < EOF

like you have. I think maybe that what is happening is that the error that is being printed is saying that it cannot find “<space>EOF” before end of file. Put the space between the word print, and remove the spaces between the << and EOF, then ensure you don’t have a space or a tab or control characters before or after the EOF and it should work.

Let me know if this helps.

Hi Christopher

(Please bottom-post your responses to this list so that long threads can
remain comprehensible. Thank you.)

It is important when posting software not to use HTML messages. As far as
I can tell, lnatz's original mail was in plain text, but your copy of her
message has lost indentation and gained spaces within the print statement
that weren't there. As you say, whitespace before the string terminator
will require the same whitespace at the end of the text, but whitespace
within the << operator as you describe won't be tolerated by the compiler
and would error. My thought was that there was whitespace after the string
terminator at the end of the string, which would be invisible in most
editors. Unfortunately the OP hasn't come back to say whether their
problem was solved.

Rob


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to