Code.GeekInterview.com
  I am new, Sign me up!
 
Code Samples Perl
 

PerlScript HTML Form


Code ResourceAuthor: srinivasaraobora  

Difficulty Level: Intermediate

Published: 25th Apr 2009   Read: 1496 times  

Filed in: Perl
Add Comment


 


This script is use to generate a html form

 


Sample Code
  1.         #!/usr/bin/perl
  2.         #programmatical.plx
  3.         use warnings;
  4.         use CGI::Pretty qw(:all);
  5.         use strict;
  6.  
  7.         my $cgi=new CGI;
  8.  
  9.         print header();
  10.         if ($cgi->param('first') and $cgi->param('last')) {
  11.                 my $first=ucfirst(lc($cgi->param('first')));
  12.                 my $last=ucfirst(lc($cgi->param('last')));
  13.                 print start_html("Welcome"),h1("Hello, $first $last");
  14.         } else {
  15.                 print start_html(-title=>"Enter your name");
  16.                 if ($cgi->param('first') or $cgi->param('last')) {
  17.                 print center(font({-color=>'red'},"You must enter a",
  18.                                 ($cgi->param('last')?"first":"last"),"name"));
  19.                 }
  20.                 print generate_form();
  21.         }
  22.         print end_html();
  23.  
  24.         sub generate_form {
  25.                 return start_form,
  26.                         h1("Please enter your name:"),
  27.                         p("First name", textfield('first')),
  28.                         p("Last name", textfield('last')),
  29.                         p(submit),
  30.                         end_form;
  31.         }
  32.  
Copyright GeekInterview.com


Next Article: Currency Converter


 

Latest Code Samples

 

Popular Code Samples

 

Related Code Samples

 

Post Comment


Members Please Login

Name:  Email: (Optional. Used for Notification)

Title:
 
Comment:
Validation Code: <=>  (Enter this code in text box)





Popular Coders

# Coder NameHits
1. srinivasaraobora5404

Active Coders

# Coder NameCodes
1. srinivasaraobora5

Refined Tags

 

Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact  

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape