view scripts/convert_degrees.pl @ 6:4246c7ef6487 boosterpack

[svn r8] bug fix -- holos need to be one int three compared to rares
author robert
date Tue, 08 Sep 2009 17:20:52 -0400
parents 477258d09353
children
line wrap: on
line source
1 #!C:/strawberry/perl/bin/perl.exe
3 use strict;
4 use CGI;
6 my $q = new CGI;
8 print $q->header();
10 if ( defined $q->param('submit') or defined $q->param('Centigrade') or defined $q->param('Kelvin')) {
11 my $result = "";
12 if ( defined $q->param('Centigrade') and $q->param('Centigrade') ne "") {
13 $result = $q->param('Centigrade') + 273.15;
14 } elsif ( defined $q->param('Kelvin') and $q->param('Kelvin') ne "" ) {
15 $result = $q->param('Kelvin') - 273.15;
16 }
17 print $result;
18 } else {
19 print &Show_Form();
20 print &Show_Footer();
21 }
23 sub Show_Form {
24 my $html = "";
25 $html .= <<EOT;
26 <HTML>
27 <HEAD><title>Temperature Conversion</title>
28 </HEAD>
29 <BODY>
30 <form>
31 Temperature =<br>
32 <input type="text" name="Centigrade" size="10"> degrees C<br>
33 <input type="text" name="Kelvin" size="10"> degrees K<br>
34 <input type="submit" name="submit" value="Convert">
35 <input type="reset"><br>
36 </form>
37 EOT
39 return $html;
40 }
42 sub Show_Footer {
43 print "</body></html>\n";
44 return;
45 }