cmin.html

 

<html>

<head><title>Converter</title></head>

<body>

<h1>Converter: Inches and Centimeters</h1>

Using this converter you can convert centimeters into inches and inches into centimeters.<br>

The formula I am using to convert centimeters to inches is multiply the cm by .39.<br>

The formula I am using to convert inches to centimeters is multiply in by 2.54.<br>

<form action="http://www.pgrocer.com/cgi-bin/func/cmin.cgi" method=post>

Enter the type of conversion:<br><br>

<input type=radio name=type value="cm">Centimeters to Inches<br>

<input type=radio name=type value="in">Inches to Centimeters<br>

Enter the number to convert:

<input type=text name=num size=4>

<input type=submit value="Convert">

<input type=reset value="Reset">

</form>

</body>

</html>

 

cmin.cgi

 

#!/usr/bin/perl

print "Content-type: text/html\n\n";

use CGI::Carp qw(fatalsToBrowser);

use CGI qw(:standard);

use strict;

my ($num, $type, $ans);

$num = param('num');

$type = param('type');

print "<html>\n";

print "<head><title>Convert</title><basefont size=4></head>\n";

print "<h1>Convert</h1>\n";

if ($type eq "cm")

{

toinches();

}

elsif ($type eq "in")

{

tocm();

}

else

{

print "No selection was made - try again!<br><br>\n";

}

print "<a href='http://www.pgrocer.com/func/cmin.html'>Click here to return to converter</a>\n";

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

exit;

# ***** user defined functions ****

sub toinches

{

$ans = ($num * .39);

print "$num centimeters is equal to $ans inches<br><br>\n";

}

sub tocm

{

$ans = ($num * 2.54);

print "$num inches is equal to $ans centimeters<br><br>\n";

}

 

cmin1.html

 

<html>

<head><title>Converter</title></head>

<body>

<h1>Converter: Inches and Centimeters</h1>

Using this converter you can convert centimeters into inches and inches into centimeters.<br>

The formula I am using to convert centimeters to inches is multiply the cm by .39.<br>

The formula I am using to convert inches to centimeters is multiply in by 2.54.<br>

<form action="http://www.pgrocer.com/cgi-bin/func/cmin1.cgi" method=post>

Enter the type of conversion:<br><br>

<input type=radio name=type value="cm">Centimeters to Inches<br>

<input type=radio name=type value="in">Inches to Centimeters<br>

Enter the number to convert:

<input type=text name=num size=4>

<input type=submit value="Convert">

<input type=reset value="Reset">

</form>

</body>

</html>

 

cmin1.cgi

 

#!/usr/bin/perl

print "Content-type: text/html\n\n";

use CGI::Carp qw(fatalsToBrowser);

use CGI qw(:standard);

use strict;

my ($num, $type, $ans, $from, $to);

$num = param('num');

$type = param('type');

print "<html>\n";

print "<head><title>Convert</title><basefont size=4></head>\n";

print "<h1>Convert</h1>\n";

if ($type eq "cm")

{

toinches();

}

elsif ($type eq "in")

{

tocm();

}

else

{

print "No selection was made - try again!<br><br>\n";

}

print "$num $from is equal to $ans $to<br><br>\n";

print "<a href='http://www.pgrocer.com/func/cmin1.html'>Click here to return to converter</a>\n";

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

exit;

# ***** user defined functions ****

sub toinches

{

$ans = ($num * .39);

$from = "centimeters";

$to = "inches";

return $ans, $from, $to;

}

sub tocm

{

$ans = ($num * 2.54);

$from = "inches";

$to = "centimeters";

return $ans, $from, $to;

}

 

cmin1a.html

 

<html>

<head><title>Converter</title></head>

<body>

<h1>Converter: Inches and Centimeters</h1>

Using this converter you can convert centimeters into inches and inches into centimeters.<br>

The formula I am using to convert centimeters to inches is multiply the cm by .39.<br>

The formula I am using to convert inches to centimeters is multiply in by 2.54.<br>

<form action="http://www.pgrocer.com/cgi-bin/func/cmin1a.cgi" method=post>

Enter the type of conversion:<br><br>

<input type=radio name=type value="cm">Centimeters to Inches<br>

<input type=radio name=type value="in">Inches to Centimeters<br>

Enter the number to convert:

<input type=text name=num size=4>

<input type=submit value="Convert">

<input type=reset value="Reset">

</form>

</body>

</html>

 

cmin1a.cgi

 

#!/usr/bin/perl

print "Content-type: text/html\n\n";

use CGI::Carp qw(fatalsToBrowser);

use CGI qw(:standard);

use strict;

my ($num, $type, $ans, $from, $to);

$num = param('num');

$type = param('type');

print "<html>\n";

print "<head><title>Convert</title><basefont size=4></head>\n";

print "<h1>Convert</h1>\n";

if ($type eq "cm")

{

toinches();

}

elsif ($type eq "in")

{

tocm();

}

else

{

print "No selection was made - try again!<br><br>\n";

}

print "$num $from is equal to $ans $to<br><br>\n";

print "<a href='http://www.pgrocer.com/func/cmin1a.html'>Click here to return to converter</a>\n";

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

exit;

# ***** user defined functions ****

sub toinches

{

$ans = ($num * .39);

$from = "centimeters";

$to = "inches";

}

sub tocm

{

$ans = ($num * 2.54);

$from = "inches";

$to = "centimeters";

}

 

cmin2.html

 

<html>

<head><title>Converter</title></head>

<body>

<h1>Converter: Inches and Centimeters</h1>

Using this converter you can convert centimeters into inches and inches into centimeters.<br>

The formula I am using to convert centimeters to inches is multiply the cm by .39.<br>

The formula I am using to convert inches to centimeters is multiply in by 2.54.<br>

<form action="http://www.pgrocer.com/cgi-bin/func/cmin2.cgi" method=post>

Enter the type of conversion:<br><br>

<input type=radio name=type value="cm">Centimeters to Inches<br>

<input type=radio name=type value="in">Inches to Centimeters<br>

Enter the number to convert:

<input type=text name=num size=4>

<input type=submit value="Convert">

<input type=reset value="Reset">

</form>

</body>

</html>

 

cmin2.cgi (contains errors)

 

#!/usr/bin/perl

print "Content-type: text/html\n\n";

use CGI::Carp qw(fatalsToBrowser);

use CGI qw(:standard);

use strict;

my ($num, $type);

$num = param('num');

$type = param('type');

print "<html>\n";

print "<head><title>Convert</title><basefont size=4></head>\n";

print "<h1>Convert</h1>\n";

if ($type eq "cm")

{

toinches();

}

elsif ($type eq "in")

{

tocm();

}

else

{

print "No selection was made - try again!<br><br>\n";

}

print "$num $from is equal to $ans $to<br><br>\n";

print "<a href='http://www.pgrocer.com/func/cmin2.html'>Click here to return to converter</a>\n";

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

exit;

# ***** user defined functions ****

sub toinches

{

my ($ans, $from, $to);

$ans = ($num * .39);

$from = "centimeters";

$to = "inches";

return $ans, $from, $to;

}

sub tocm

{

my ($ans, $from, $to);

$ans = ($num * 2.54);

$from = "inches";

$to = "centimeters";

}

 

 

 

stringfunc.cgi

 

#!/usr/bin/perl

#stringfunc.cgi - reads the payroll file and processes with functions

use CGI::Carp qw(fatalsToBrowser);

print "Content-type: text/html\n\n";

use CGI qw(:standard);

use strict;

#declare variables

my ($id, $name, $stadr, $city, $state, $zip, $jobtype, $jobcode, $payperhr, $salary);

open(INF, "<", "payroll1.txt")

or die "file error: payroll1.txt. $!, stopped";

while(<INF>) {

chomp($_);

($name,$stadr,$city,$state,$zip,$jobtype,$jobcode,$payperhr,$salary) = split(/,/,$_);

createid();

print "The id is: $id <br> The name is: $name<br>\n";

}

close(INF);

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

exit;

#********user defined functions****************

sub createid

{

my($namefst3, $statelc, $citymid,$jc3);

$namefst3 = lcfirst(substr($name,0,3));

$statelc = lc($state);

$citymid = lc(substr($city,3,2));

$jc3 = $jobcode x 3;

$id = $namefst3.$statelc.$jc3.$citymid;

return $id;

}

 

stringfuncmore.cgi

 

#!/usr/bin/perl

#stringfuncmore.cgi - reads the payroll file and processes with functions

use CGI::Carp qw(fatalsToBrowser);

print "Content-type: text/html\n\n";

use CGI qw(:standard);

use strict;

#declare variables

my ($wherea, $name, $stadr, $city, $state, $zip, $jobtype, $jobcode, $payperhr, $salary);

open(INF, "<", "payroll1.txt")

or die "file error: payroll1.txt. $!, stopped";

while(<INF>) {

chomp($_);

($name,$stadr,$city,$state,$zip,$jobtype,$jobcode,$payperhr,$salary) = split(/,/,$_);

finda();

print "The city is: $city The a is located at position: $wherea<br>\n";

}

close(INF);

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

exit;

#********user defined functions****************

sub finda

{

$wherea = index($city,"a");

return $wherea;

}

datefunc.cgi

 

#!/usr/bin/perl

#stringfuncmore.cgi - reads the payroll file and processes with functions

use CGI::Carp qw(fatalsToBrowser);

print "Content-type: text/html\n\n";

use CGI qw(:standard);

use strict;

#declare variables

my ($sec,$min,$hour,$mday,$mond,$year,$wday,$yday,$isdst,$myhour,$mymond, $myyear);

print "<html><head><title>Date</title></head>\n";

print "<body>\n";

print "<h1>Bristol Community College</h1>\n";

checkdate();

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

exit;

#********user defined functions****************

sub checkdate

{

($sec,$min,$hour,$mday,$mond,$year,$wday,$yday,$isdst) = localtime(time);

$myhour = $hour;

$mymond = $mond +1;

$myyear = $year + 1900;

print "<h2>The date is: $mymond/$mday/$myyear</h2>\n";

print "<font size=4>";

if ($myhour >=8 and $myhour < 16)

{

print "Day school schedule\n";

}

else

{

if ($myhour >=16 and $myhour < 22)

{

print "Evening schedule\n";

}

else

{

print "The campus is closed\n";

}

}

}

print "</font";