CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: General Discussions: General Questions:
new to perl need some help please

 



Delux
New User

Feb 18, 2007, 1:19 PM

Post #1 of 2 (3248 views)
new to perl need some help please Can't Post

Hey, I am taking a class in perl, and my assignement was to make this form so i have the form all made and it works, now i have to take this form and have the data that is entered saved to a text file. how would i go about doing this. here is my perl file.

Code
#!C:/Perl/bin/perl.exe 
#juniper.cgi - creates a dynamic Web page that acknowledges
#the receipt of a registration form
print "Content-type: text/html\n\n";
use CGI qw(:standard);
use strict;

#declare variables (** change $ to @ in sysletter / add $key **)
my ($name, $serial, $modnum, @sysletter, $key);
my @models = ("Laser JX", "Laser PL", "ColorPrint XL");

# add hash declaration
my %systems = ("W", "Windows",
"M", "Macintosh",
"L", "Linux");

#assign input items to variables
$name = param('Name');
$serial = param('Serial');
$modnum = param('Model');
# (** change $ to @ in sysletter)
@sysletter = param('System');

#create Web page
print "<html><head><title>Juniper Printers</title></head>\n";
print "<BODY><H2>\n";
print "Thank you, $name, for completing \n";
print "the registration form.<br /><br />\n";
print "We have registered your Juniper $models[$modnum] printer, \n";
print "serial number, $serial. \n";

# (** modify hash references for multiple selections **)
print "You indicated that the printer will be used on the \n";
print "following systems: <br /> \n";
foreach $key (@sysletter) {
print "$systems{$key} <br />\n";
}

print "</h2></body></html>\n";


if you need me to post my form file i can do that as well. thanks


KevinR
Veteran


Feb 18, 2007, 9:39 PM

Post #2 of 2 (3239 views)
Re: [Delux] new to perl need some help please [In reply to] Can't Post

look up the 'open', 'print', and 'close' functions.

http://perldoc.perl.org/index-functions.html
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives