#!/usr/local/bin/perl # energy.pl # Author: Alan Levine #> # Calculates estimated maximum velocity for # input height using simple energy laws # #< # require("CGI.pm"); # Load CGI.pm library to handle input and objects use CGI qw(:standard :cgi-lib); use CGI::Carp qw(fatalsToBrowser); # parse form variables to array &ReadParse; # print return html header print header; if (($in{'height'} =~ /\d/) and ( $in{'height'} > 0) ) { # set the gravity constant if ( $in{'units'} eq "meters") { $g = 9.8; } else { $g = 32.0; } $vel = sprintf( "%d", sqrt( 2 * $g * $in{'height'})); print <<"end_html";