"Jason B" schreef:
> #!/usr/bin/perl
Missing:
use strict;
use warnings;
> #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";
Alternative:
print <<'EOT';
Hi. I'm going to help you calculate the circumference of a circle
EOT
> $pi = 3.141592654;
my $pi = atan2(0, -1);
> 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";
print <'EOT';
Psst...
The radius can't be less than zero.
Let me help you out there
EOT
> }
>
> $diameter = ($radius * 2);
> $area = ($pi * ($radius ** 2));
> $circumf = ($diameter * $pi);
Really no need for all those patrentheses.
my $diameter = $radius * 2;
my $area = $pi * $radius ** 2;
my $circumf = $diameter * $pi;
> print " Radius: $radius\n Diameter: $diameter\n Area: $area\n And
> finally!!!\n Circumference: $circumf\n";
print <<"EOT"
\tRadius : $radius
\tDiameter : $diameter
\tArea : $area
And finally!!!
\tCircumference: $circumf
EOT
__END__
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/