grosspwb.cgi
#!/usr/bin/perl
#grosspwb.cgi -
computes gross pay and a dynamic web page
print
"Content-type: text/html\n\n";
#avoid undeclared
variables
use strict;
#declare variables
my($name, $payhr,
$hours, $bonus, $gross, $grossyr);
$name = "Susan
Ash";
$payhr = 55.75;
$hours = 40;
$bonus = 5000;
#calculate gross pay
$gross = $payhr *
$hours;
$grossyr = $payhr *
$hours * 52 + $bonus;
#create gross pay
web page
print
"<html>\n";
print
"<head><title>Gross Pay</title></head>\n";
print
"<h1>Calculate Gross Pay</h1>\n";
print
"<body>\n";
print
"Employee: $name<br>\n";
print "Pay
rate: $payhr<br>\n";
print "Hours:
$hours<br>\n";
print "Gross
pay: $gross<br>\n";
print "Yearly
gross pay: $grossyr<br>\n";
print
"</body>\n";
print
"</html>\n";
grosspwb1.cgi
#!/usr/bin/perl
#grosspwb.cgi -
computes gross pay and a dynamic web page
print
"Content-type: text/html\n\n";
#avoid undeclared
variables
use strict;
#declare variables
my($name, $payhr,
$hours, $bonus, $gross, $grossyr);
$name = "Susan
Ash";
$payhr = 55.75;
$hours = 40;
$bonus = 5000;
#calculate gross pay
$gross = $payhr *
$hours;
$grossyr = $payhr *
$hours * 52;
$grossyr = $grossyr
+ $bonus;
#create gross pay
web page
print
"<html>\n";
print
"<head><title>Gross Pay</title></head>\n";
print
"<h1>Calculate Gross Pay</h1>\n";
print
"<body>\n";
print
"Employee: $name\n";
print "Pay
rate: $payhr\n";
print "Hours:
$hours\n";
print "Gross
pay: $gross<br>\n";
print "Yearly
gross pay: $grossyr<br>\n";
print
"</body>\n";
print
"</html>\n";
grosspost.html
<html>
<head><title>Spruce
Department Store</title></head>
<body>
<div
align=center>
<h1>Get Pay
Information</h1>
<img
src="spruce.gif">
</div>
<form
action="http://www.pgrocer.com/cgi-bin/begin/grosspar.cgi"
method=post>
Employee Name:
<input
name=Employee Size=20><br><br>
Pay per Hour:
<input
name=PayHour Size=5><br><br>
Hours Worked:
<input
name=NumHours Size=5><br><br>
Bonus:
<input name=Bonus
Size=5><br><br>
<input
type=submit value=Submit><br>
<input type=reset
value=Reset>
</form>
</body>
</html>
grosspar.cgi
#!/usr/bin/perl
#grosspar.cgi -
computes gross pay and a dynamic web page
print
"Content-type: text/html\n\n";
use CGI
qw(:standard);
#avoid undeclared
variables
use strict;
#declare variables
my($name, $payhr,
$hours, $bonus, $gross, $grossyr);
$name = param('Employee');
$payhr =
param('PayHour');
$hours =
param('NumHours');
$bonus =
param('Bonus');
#calculate gross pay
$gross = $payhr *
$hours;
$grossyr = $payhr *
$hours * 52 + $bonus;
#create gross pay
web page
print
"<html>\n";
print
"<head><title>Gross Pay</title></head>\n";
print
"<h1>Calculate Gross Pay</h1>\n";
print
"<body>\n";
print
"Employee: $name<br>\n";
print "Pay
rate: $payhr<br>\n";
print "Hours:
$hours<br>\n";
print "Gross
pay: $gross<br>\n";
print "Yearly
gross pay: $grossyr<br>\n";
print "</body>\n";
print
"</html>\n";
grossget.html
<html>
<head><title>Spruce
Department Store</title></head>
<body>
<div
align=center>
<h1>Get Pay
Information</h1>
<img
src="spruce.gif">
</div>
<form
action="http://www.pgrocer.com/cgi-bin/begin/grosspar.cgi"
method=get>
Employee Name:
<input
name=Employee Size=20><br><br>
Pay per Hour:
<input
name=PayHour Size=5><br><br>
Hours Worked:
<input
name=NumHours Size=5><br><br>
Bonus:
<input name=Bonus
Size=5><br><br>
<input
type=submit value=Submit><br>
<input type=reset
value=Reset>
</form>
</body>
</html>
grossparx.cgi
#!/usr/bin/perl
#grosspay.cgi -
computes gross pay and a dynamic web page
print
"Content-type: text/html\n\n";
use CGI
qw(:standard);
use CGI::Carp
qw(fatalsToBrowser);
#avoid undeclared
variables
use strict;
#declare variables
my($name, $payhr,
$hours, $bonus, $gross, $grossyr);
$name =
param('Employee');
$payhr =
param('PayHour');
$hours =
param('NumHours');
$bonus =
param('Bonus');
#calculate gross pay
$gross = $payhr *
$hours;
$grossyr = $payhr *
$hours * 52 + $bonus;
#create gross pay
web page
print
"<html>\n";
print
"<head><title>Gross Pay</title></head>\n"
print
"<h1>Calculate Gross Pay</h1>\n";
print
"<body>\n";
print
"Employee: $name<br>\n"
print "Pay
rate: $payhr<br>\n";
print "Hours:
$hours<br>\n";
print "Gross
pay: $gross<br>\n";
print "Yearly
gross pay: $grossyr<br>\n";
print
"</body>\n";
print
"</html>\n";