Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: loop problem

by monsenhor (Novice)
on Jun 12, 2018 at 22:17 UTC ( [id://1216509]=note: print w/replies, xml ) Need Help??


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 } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1216509]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2024-04-18 13:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found