#file.pl #!/usr/bin/perl use strict; use CGI::Cookie; use CGI; my $cgi = new CGI; my $file = "/var/www/html/datfiles/data.dat"; print $cgi->header( -cookie => new CGI::Cookie(-name => 'ChocolateChip', -value=> $cgi->param('color'), -expires => 'Thu, 26-Sep-2002 00:00:00 GMT'#, #-domain => 'students.byu.edu', #-path => '/' ) ); print $cgi->start_html(-title => 'Results', -bgcolor => $cgi->param('color')); if ($cgi->param()) { print $cgi->center( $cgi->h3("Hello: ". $cgi->param('name')), $cgi->p, "The keywords are: ",join(", ",$cgi->param('words')), $cgi->p, "Your favorite color is: ",$cgi->param('color')); } printing(); print $cgi->end_html(); sub printing { open(FILE, ">$file")|| die "Cannot save file $file "; print "test"; print FILE $cgi->param('name'); print FILE join(", ",$cgi->param('words')); print FILE $cgi->param('color'); close FILE; }