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

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.

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

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

      Declare the variables outside the subroutine

      #!/usr/bin/env perl use strict; use warnings; use utf8; use feature "say"; use Math::Trig; my ($radius,$c); sub intro { say "What is the radius?"; $radius = <STDIN>; chomp ($radius); my $a = 2*pi; $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 }
      poj

        Ahhh, now I understand. D'oh! :D

        Note the missing semi-colon on one of the last lines there...

      I do not understand what you mean by "submodule". Again, could you share the code you're speaking of?

      We can help you understand not just how to do the loop, but the issues with the other code you have. Look at it as a learning exercise ;)