FAQ
HI,
I have the attached script which reads the input text file of the form:
# cat rpcinfo.txt

program vers proto port service response
100000 4 tcp 111 portmapper program 100000 version 4 ready
and waiting
100000 3 tcp 111 portmapper program 100000 version 3 ready
and waiting
100000 2 tcp 111 portmapper program 100000 version 2 not
ready

The input text file describes the output from another script detailing the
output from the rpcinfo UNIX utility.

In the attached script, I would like to read the lines matching the string
"not ready" and sends an e-mail notification to the sysadmin detailing the
process id and service name that matched the string "not ready". However,
the script produce the following syntax error below, when it comes to the
SENDMAIL part in the sub-routine sendMail:

pglc0003@penang[24]% ./summer.pl
Bareword found where operator expected at ./summer.pl line 78, near "print
SENDMAIL "TO"
(Might be a runaway multi-line "" string starting on line 77)
(Do you need to predeclare print?)
syntax error at ./summer.pl line 78, near "print SENDMAIL "TO"
Backslash found where operator expected at ./summer.pl line 78, near
"$rpcAdmList \"
(Missing operator before \?)
String found where operator expected at ./summer.pl line 79, near "print
SENDMAIL ""
(Might be a runaway multi-line "" string starting on line 78)
(Missing semicolon on previous line?)
Bareword found where operator expected at ./summer.pl line 79, near "print
SENDMAIL "Subject"
(Do you need to predeclare print?)
String found where operator expected at ./summer.pl line 80, near "print
SENDMAIL ""
(Might be a runaway multi-line "" string starting on line 79)
(Missing semicolon on previous line?)
Bareword found where operator expected at ./summer.pl line 80, near "print
SENDMAIL "Date"
(Missing operator before Date?)
Backslash found where operator expected at ./summer.pl line 80, near "`date`
\"
(Missing operator before \?)
String found where operator expected at ./summer.pl line 81, near "print
SENDMAIL ""
(Might be a runaway multi-line "" string starting on line 80)
Bareword found where operator expected at ./summer.pl line 81, near "print
SENDMAIL "PROGRAM"
(Do you need to predeclare print?)
Backslash found where operator expected at ./summer.pl line 81, near
"PROGRAM\"
Backslash found where operator expected at ./summer.pl line 81, near "t\"
Backslash found where operator expected at ./summer.pl line 81, near
"tPORT\"
Backslash found where operator expected at ./summer.pl line 81, near "t\"
Backslash found where operator expected at ./summer.pl line 81, near
"tSERVICE\"
Backslash found where operator expected at ./summer.pl line 81, near "t\"
Backslash found where operator expected at ./summer.pl line 81, near
"tRESPONSE\"
Backslash found where operator expected at ./summer.pl line 81, near "t\"
Backslash found where operator expected at ./summer.pl line 81, near "t\"
String found where operator expected at ./summer.pl line 82, near "print
SENDMAIL ""
(Might be a runaway multi-line "" string starting on line 81)
(Missing semicolon on previous line?)
Scalar found where operator expected at ./summer.pl line 82, at end of line
(Do you need to predeclare print?)
Backslash found where operator expected at ./summer.pl line 82, near
"$portNum\"
(Missing operator before \?)
Backslash found where operator expected at ./summer.pl line 82, near "t\"
Backslash found where operator expected at ./summer.pl line 82, near
"$portNum\"
(Missing operator before \?)
Backslash found where operator expected at ./summer.pl line 82, near "t\"
Backslash found where operator expected at ./summer.pl line 82, near
"$service\"
(Missing operator before \?)
Backslash found where operator expected at ./summer.pl line 82, near "t\"
Backslash found where operator expected at ./summer.pl line 82, near
"$progResp\"
(Missing operator before \?)
Backslash found where operator expected at ./summer.pl line 82, near "t\"
Backslash found where operator expected at ./summer.pl line 82, near "t\"
String found where operator expected at ./summer.pl line 82, at end of line
(Missing semicolon on previous line?)
Can't find string terminator '"' anywhere before EOF at ./summer.pl line 82.

I was wondering if anyone could tell me where did I go wrong & how do I
resolve such errors? Any examples would indeed be helpful.

Thanks in advance.
<<summer.ZIP>>

Search Discussions

  • Geer, David van der at Jun 2, 2003 at 10:54 am

    pglc0003@penang[24]% ./summer.pl
    Bareword found where operator expected at ./summer.pl line 78, near "print
    SENDMAIL "TO"
    (Might be a runaway multi-line "" string starting on line 77)
    (Do you need to predeclare print?)
    syntax error at ./summer.pl line 78, near "print SENDMAIL "TO"
    Backslash found where operator expected at ./summer.pl line 78, near
    "$rpcAdmList \"
    (Missing operator before \?)
    Sending messages containing quotes itself as well might result in these errors. I know there are possibilities to fix it.
    You could do a regex in advance of :

    $mystring =~ s/"/\"/g;

    and then

    print SENDMAIL "$mystring";

    Of course there are multiple errors, and this is not tested yet, but could be your solution.
    I solved this using attached korn-shell script.


    Regs David



    *********************************************************************
    This message is intended only for the person or entity to
    which it is addressed and may contain confidential and/or
    privileged information, the disclosure of which is prohibited.
    If you are not the intended recipient you may not read,
    use, disseminate or copy the information transmitted. If
    you have received this message in error, please contact
    the sender and delete the material from any computer.
    Dit bericht is uitsluitend bestemd voor de (rechts)persoon
    aan welke het is gericht. Het kan vertrouwelijke of
    alleen voor deze bestemde informatie bevatten, die niet
    mag worden geopenbaard. Als dit bericht niet voor u
    bestemd is, mag u de ontvangen informatie niet lezen,
    gebruiken, verspreiden of kopieren. Als u dit bericht
    abusievelijk hebt ontvangen, gelieve u het te deleten en
    contact op te nemen met de afzender.
    ********************************************************************



    **********************************************************************
    This email and any files transmitted with it are confidential and
    intended solely for the use of the individual or entity to whom they
    are addressed. If you have received this email in error please notify
    the system manager.

    This footnote also confirms that this email message has been swept by
    MIMEsweeper for the presence of computer viruses.

    www.mimesweeper.com
    **********************************************************************

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedJun 1, '03 at 7:24a
activeJun 2, '03 at 10:54a
posts2
users2
websiteperl.org

People

Translate

site design / logo © 2021 Grokbase