Hi,
I'm only a couple days into learning perl here.. but I've been having this
problem with subroutines I can't seem to figure out. Could someone explain
what I'm doing wrong here:
#!/usr/bin/perl
require "cgi-lib.pl";
require "ctime.pl";
$date = &ctime(time);
chop($date);
$datafile=">>harvest.txt";
$URL = "http://www.cnet.com/";
$ip = $ENV{'REMOTE_ADDR'};
&ReadParse;
#print &PrintHeader;
if ( $in{'agree'} ne "" ) {
#### THE PROBELM IS HERE.. I just want it to run the
#### doStore sub, then run the doRedirect sub.. but
#### I'm not sure on the syntax of how to do it.
&doStore;
&doRedirect;
} else {
&doSorryNoAgree;
}
sub doSorryNoAgree {
print &PrintHeader;
print "<html><head><title>Oops!</title></head>\n";
print "\n";
print "<body bgcolor=\"#ffffff\">\n";
print "<table align=\"center\" bgcolor=\"#000000\" border=\"0\"
cellpadding=\"0\" cellspacing=\"0\">\n";
print " <tr><td>\n";
print " <table align=\"center\" bgcolor=\"#FFFFFF\" border=\"0\"
cellpadding=\"2\" cellspacing=\"2\" width=\"100%\">\n";
print " <tr><td align=\"center\" bgcolor=\"#0000FF\">\n";
print " <b><font face=\"arial\" size=\"5\">Error!</font></b>\n";
print " </td></tr><tr><td>\n";
print " <font face=\"arial\">The check box must be checked
first.</font>\n";
print " </td></tr>\n";
print " </table>\n";
print " </td></tr>\n";
print "</table>\n";
print "</form>\n";
print "</body></html>\n";
}
sub doStore {
open(OUTFILE, $datafile);
select(OUTFILE);
print OUTFILE "\n$date | $in{'username'} | $in{'password'} | $in{'email'} |
$ip";
close(OUTFILE);
}
sub doRedirect {
print ("Location: $URL\n\n");
}
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com