#!/usr/bin/perl use CGI qw(:standard); print header,start_html('Sample CGI'); print ""; if (param('name')){ &print_output(); } else{ &print_form(); } print ""; print end_html; sub print_form{ print "
"; print "Your Name
"; print "Favorite Color
"; print " "; } sub print_output{ my $name = param('name'); my $color = param('color'); print " Hi $name, Welcome !! "; print "As per our records, your favorite color is $color"; }