in reply to loop problem
#!/usr/bin/env perl use strict; use warnings; use utf8; use feature "say"; use Math::Trig; &ask; sub ask{ say "What is the radius?"; my $radius= <STDIN>; chomp ($radius); if ($radius==0) { say "circumference= ", $radius; } elsif ($radius<0) { say "Radius should be greater than 0"; &ask; } else { my $a = 2*pi; my $c = $a * $radius; say "circumference= ", $c } }
|
|---|