#!/usr/bin/perl #band.cgi - saves data to and removes data from a database #creates appropriate dynamic Web pages print "Content-type: text/html\n\n"; use CGI qw(:standard -debug); use SDBM_File; use Fcntl; #prevent Perl from creating undeclared variables use strict; #declare variables my ($button, $name, $email); #assign values to variables $button = param('Button'); $name = param('Name'); $email = param('Email'); if ($button eq "Put Me On Your Mailing list") { add(); } elsif ($button eq "Remove Me From Your Mailing List") { remove(); } exit; #*****user-defined functions***** sub add { #declare variable my %mail; #open database, add record, close database tie(%mail, "SDBM_File", "maillist", O_CREAT|O_RDWR, 0666) or die "Error opening maillist. $!, stopped"; $mail{$email} = $name; untie(%mail); #create Web page print "\n"; print "