Can't find string terminator "EOM" - beginner question

H

humphrey.c.chan

Hello,

I am a beginner in Perl programming. Currently, I am using Perl
5.005_03 in my Solaris 8 server.

I am getting the following error message when running my program :

Can't find string terminator "EOM" anywhere before EOF at ./my-prog.pl
line 107.

Here's my program excerpt -->>

:
:
105 open (MAIL, "| /usr/lib/sendmail -oi -t");
106 select(MAIL);
107 print <<EOM;
108 From: (e-mail address removed)
109 To: (e-mail address removed)
110
111 Subject: Alert !! Alert !!
112
113
114 Please check the system
115 at your earliest convenience......
116
117 PS: You know who you arev !!
118
119
120 EOM

Plesae help me to resolve the problem.

Thanks

Humphrey
 
S

skye.shaw

err, make sure your EOM marker is aligned with the left side of the
page, no spaces. If not the end of the file is reached and the here
document terminator is never found -as is the case with your code.

Although I have never piped into sendmail from Perl, is there any
reason why U chose to select() prior to sending your output?
 
T

Tad McClellan

I am getting the following error message when running my program :

Can't find string terminator "EOM" anywhere before EOF at ./my-prog.pl
line 107.
Here's my program excerpt -->>

107 print <<EOM;
108 From: (e-mail address removed)
109 To: (e-mail address removed)
110
111 Subject: Alert !! Alert !!
112
113
114 Please check the system
115 at your earliest convenience......
116
117 PS: You know who you arev !!
118
119
120 EOM
^
^ looks like there is a space character there...
Plesae help me to resolve the problem.


Remove the space character infront of the EOM, it must be
flush to the left margin.

(or, insert a space when you specify the terminator: print <<" EOM"; )
 
J

Joe Smith

Although I have never piped into sendmail from Perl, is there any
reason why U chose to select() prior to sending your output?

That's the thing about Perl: there is more than one way to do it.

select(MAIL); print $string;
and
print MAIL $string;
are two ways of accomplishing the same thing.

Personally, I would avoid the select() way; bad things can happen
if you forget to select(STDOUT) later on.

-Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,125
Latest member
VinayKumar Nevatia_
Top