rlm@0: #!C:/strawberry/perl/bin/perl.exe rlm@0: rlm@0: use strict; rlm@0: use CGI; rlm@0: rlm@0: my $q = new CGI; rlm@0: rlm@0: print $q->header(); rlm@0: rlm@0: if ( defined $q->param('submit') or defined $q->param('Centigrade') or defined $q->param('Kelvin')) { rlm@0: my $result = ""; rlm@0: if ( defined $q->param('Centigrade') and $q->param('Centigrade') ne "") { rlm@0: $result = $q->param('Centigrade') + 273.15; rlm@0: } elsif ( defined $q->param('Kelvin') and $q->param('Kelvin') ne "" ) { rlm@0: $result = $q->param('Kelvin') - 273.15; rlm@0: } rlm@0: print $result; rlm@0: } else { rlm@0: print &Show_Form(); rlm@0: print &Show_Footer(); rlm@0: } rlm@0: rlm@0: sub Show_Form { rlm@0: my $html = ""; rlm@0: $html .= < rlm@0: Temperature Conversion rlm@0: rlm@0: rlm@0:
rlm@0: Temperature =
rlm@0: degrees C
rlm@0: degrees K
rlm@0: rlm@0:
rlm@0:
rlm@0: EOT rlm@0: rlm@0: return $html; rlm@0: } rlm@0: rlm@0: sub Show_Footer { rlm@0: print "\n"; rlm@0: return; rlm@0: }