#!/usr/bin/perl -w #All perl scripts should use strict use strict; use CGI; my $cgi_object = new CGI(); # You must print out a header so that HTTPObject can communicate with # the script. print $cgi_object->header(); # Retrieve the input value. i.e. des, phil, daveB whatever. my $input = $cgi_object->param('name'); # This is the hashtable holding everyones info. This could just as easily # be held in a .txt file on the server, or in a MySQL database, or anywhere # that user data is typically held. my %mates = ( 'des' => 'Des,Traynor,dez.jpg,Archilpelagos is hard to spell', 'phil'=> 'Phil,Brennan,phil.jpg,To CC or not to CC that is not a question', 'daveC'=>'Dave,Cahill,davce.jpg,One Man Army', 'daveB'=>'Dave,Barrett,daveb.jpg,Dont look at antidis.com', 'micheal'=>'Micheal,Glennon,micheal.jpg,there is no list' ); # If an invalid name is input, return the standard blank form if( length($mates{$input}) <1 ) { print"John,Doe,unknown.jpg,No known catchphrase"; } else{ # Otherwise return the relevant data. print "$mates{$input}"; }