# !/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 parameters to # this function is the format string and ctime returned by the localtime function. # The format specifers in the format string are # %A - day of the week, %B - month, %d - day of the month, %Y - four digit year # %H - hour, %M - minute, %S - seconds $now_time = strftime "%A, %B %d, %Y %H:%M:%S", localtime; print<<"HTML"; Perl Sample - Hello User
Hello User



Hello $in{'name'}




$now_time



Back

END_OF_PRINT } # This function is to display the initial page to accept the name from the user. The javascript # ensures that user enters some text. sub displayForm { print<<"HTML"; Perl Sample - Hello User
Hello User



Please Enter your Name :



END_OF_PRINT }