# !/visnsdb/9.2.0/Apache/perl/bin/perl # Standard Perl CGI library use CGI qw(:cgi-lib); # Parse arguments local *in; &ReadParse(*in); # Flush StdOut $| = 1; # Print HTTP Header print &PrintHeader; #Check to see if the username is entered if ($in{'name'}) { &displayResults; } else { &displayForm; } exit(0); # This function is to display the Hello user message, date and time. sub displayResults { #Load POSIX Module use POSIX "strftime"; # strftime fuction converts the date and time into string. The para +meters to # this function is the format string and ctime returned by the loca +ltime function. # The format specifers in the format string are # %A - day of the week, %B - month, %d - day of the month, %Y - fou +r digit year # %H - hour, %M - minute, %S - seconds $now_time = strftime "%A, %B %d, %Y %H:%M:%S", localtime; print<<"HTML"; <TITLE>Perl Sample - Hello User</TITLE> <BODY BGCOLOR="#FFFFFF"> <CENTER> <TABLE WIDTH=75%><TR> <TD BGCOLOR="#334444"><CENTER> <FONT COLOR= FF0000 SIZE=5 FACE= Arial>Hello User</FONT></CENT +ER> </TD></TR><TR><TD><CENTER><BR><BR><BR> <H1> Hello <I>$in{'name'}</I> </H1> </FONT><BR><BR><BR> $now_time <BR><BR><BR><BR> <A HREF=helloUser.pl>Back</A><BR> <P></TD></TR></CENTER></TABLE></CENTER> </BODY> </HTML> END_OF_PRINT } # This function is to display the initial page to accept the name f +rom the user. The javascript # ensures that user enters some text. sub displayForm { print<<"HTML"; <TITLE>Perl Sample - Hello User</TITLE> <BODY BGCOLOR="#FFFFFF"> <CENTER> <TABLE WIDTH=75%><TR> <TD BGCOLOR="#334444"><CENTER> <FONT COLOR= FF0000 SIZE=5 FACE= Arial>Hello User</FONT></CENT +ER> </TD></TR><TR><TD><CENTER> <P><FONT FACE="Arial"> <BR><BR><B> Please Enter your Name :</B> </FONT></P> <FORM ACTION="helloUser.pl" METHOD="POST"> <P><INPUT TYPE="text" SIZE="20" NAME="name" VALUE=""><BR><BR> <INPUT TYPE="button" NAME="B1" VALUE="Submit" onClick=validate +Form()></P></CENTER> </FORM></CENTER></TD></TR></TABLE> </BODY> </HTML> <SCRIPT LANGUAGE="javascript"> function validateForm() { if ( document.forms[0].name.value == "") { window.alert("Please enter the name"); } else { document.forms[0].submit(); } } </SCRIPT> END_OF_PRINT }

In reply to i got error cannot find string terminator "HTML" anywhere before EOF by venugopal

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.