in reply to Re: loop problem
in thread loop problem
#!/usr/bin/env perl # use strict; use warnings; use utf8; use feature "say"; use Math::Trig; sub intro { say "What is the radius?"; our $radius= <STDIN>; chomp ($radius); our $a = 2*pi; our $c = $radius * $a } intro(); if ($radius==0) { say "circumference= ", $radius; } elsif ($radius<0) { say "Radius should be greater than 0"; intro(); } else { say "circumference= ", $c }
But you have to switch off the strict command to make it work. And then it still doesn't work like I want it to.
How to create the loop I want?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: loop problem
by AnomalousMonk (Archbishop) on Jun 12, 2018 at 19:16 UTC | |
|
Re^3: loop problem
by stevieb (Canon) on Jun 12, 2018 at 17:05 UTC | |
by WisDomSeeKer34 (Sexton) on Jun 12, 2018 at 17:13 UTC | |
by stevieb (Canon) on Jun 12, 2018 at 17:18 UTC | |
by WisDomSeeKer34 (Sexton) on Jun 12, 2018 at 17:33 UTC | |
by poj (Abbot) on Jun 12, 2018 at 18:05 UTC | |
| |
by stevieb (Canon) on Jun 12, 2018 at 18:03 UTC |