Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

perl program giving errors

by peacepanda3 (Initiate)
on Mar 14, 2012 at 15:05 UTC ( [id://959590]=perlquestion: print w/replies, xml ) Need Help??

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

This is the error that I am getting in the apache error log file syntax error at C:/wamp/bin/apache/Apache2.2.21/cgi-bin/date.cgi line 12, near "print "</body"\r Wed Mar 14 20:26:24 2012 error client 127.0.0.1 Search pattern not terminated at C:/wamp/bin/apache/Apache2.2.21/cgi-bin/date.cgi line 13.\r The code for the date.cgi file is as below
#!/usr/bin/perl # print CGI header print "Content-Type: text/html\n\n"; # now print the time print "<html> <head>\n"; print "<title>Current Date and Time</title>\n"; print "</head> <body>\n"; print "<h1>The date is now</h1>\n"; print "<p>$time = (localtime),"</p>"; print "</body>\n" print "</html>\n";
Can some one tell me what is that I am doing wrong.Thanks Ajit

Replies are listed 'Best First'.
Re: perl program giving errors
by Anonymous Monk on Mar 14, 2012 at 15:11 UTC

    This line has misplaced quote, fix it

    - print "<p>$time = (localtime),"</p>"; + print "<p>", scalar(localtime),</p>";
Re: perl program giving errors
by choroba (Cardinal) on Mar 14, 2012 at 15:12 UTC
    Line 11 misses a double quote.
Re: perl program giving errors
by thargas (Deacon) on Mar 14, 2012 at 17:52 UTC
    and line 12 is missing a trailing semi-colon
Re: perl program giving errors
by mendeepak (Scribe) on Mar 15, 2012 at 05:45 UTC

    <font color=red">print "</body>\n" semi colon at the end of line is missing For future programming do put -w in the shebang line #!/usr/bin/perl -w so that errors will be shown to an extend

      You probably mean "warnings", not "errors".
        yup

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://959590]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (1)
As of 2024-04-16 01:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found