#pressalt.cgi by Tim Brice NWS El Paso
#change station pressure to millibars
if ($ps{press} =~ /-?(\d+)\.?(\d+)|^\d+$/) {
if ($ps{mborin} =~ millibars) {
$press = $ps{press};
} else {
$press = $ps{press} * 33.8639;
}
} else {
print "An illegal character was entered.\n";
}
#Do some math
$pstd = 1013.25;
$pa = (1 - ($press/$pstd)**.190284) * 145366.45;
$pa1 = $pa * 0.3048;
#Output time
$~ = PS1;
write;
format PS1 =
With a station pressure of @###.## @<<<<<<<<<<<<<<<<<:
$ps{press}, $ps{mborin}
You get a pressure altitude of @####.# feet or @####.# meters
$pa $pa1
.