I'm really new to programming and this is my first perl prog.  I'm looking
for any advice or comments on this script.

(I don't want to develop bad habits from the start)

Thx.

#!/usr/bin/perl

#Name:circumf
#Date:Jun19/08
#Author:Bornhoft, J
#Purpose:to calculate the circumference of a circle

print "Hi. I'm going to help you calculate the circumference of a circle\n";

$pi = 3.141592654;

print "What is the radius of the circle?: ";
chomp($radius = <STDIN>);

if ($radius < 0) {
    $radius = 0;
    print "Psst...\nThe radius can\'t be less than zero.\nLet me help you
out there\n";
}

$diameter = ($radius * 2);
$area = ($pi * ($radius ** 2));
$circumf = ($diameter * $pi);

print " Radius: $radius\n Diameter: $diameter\n Area: $area\n And
finally!!!\n Circumference: $circumf\n";

Reply via email to