in reply to Re^2: loop problem
in thread loop problem

What error does strict throw? Works fine for me as-is on 5.26.1.

Anyway, here's an example of how to get what you want:

my $radius = -1; until ($radius >= 0){ say "What is the radius?"; $radius= <STDIN>; chomp ($radius); say "radius must be >= 0. Try again..."; }

Replies are listed 'Best First'.
Re^4: loop problem
by WisDomSeeKer34 (Sexton) on Jun 12, 2018 at 17:13 UTC

    Regarding your question: if I run the program with the submodule with strict, I get this output:

    Variable "$radius" is not imported at circum1.pl line 19. Variable "$radius" is not imported at circum1.pl line 20. Variable "$radius" is not imported at circum1.pl line 23. Variable "$c" is not imported at circum1.pl line 30. Global symbol "$radius" requires explicit package name (did you forget + to declare "my $radius"?) at circum1.pl line 19. Global symbol "$radius" requires explicit package name (did you forget + to declare "my $radius"?) at circum1.pl line 20. Global symbol "$radius" requires explicit package name (did you forget + to declare "my $radius"?) at circum1.pl line 23. Global symbol "$c" requires explicit package name (did you forget to d +eclare "my $c"?) at circum1.pl line 30. Execution of circum1.pl aborted due to compilation errors.
    And thank you for answering my question.

      If you're getting those errors/warnings, then the code you posted isn't the code you're running I don't suspect.

      The only issue that I see with syntax is a missing semi-colon after say "circumference= ", $c

      If that doesn't fix things, please post the actual code you're using.

        The code with the submodule in it gives these errormessages. I ran it again and again.