Hey y'all,

I suspect that I'm struggling with something that has a *really*
straightforward alternative, but I don't do a lot of programming in perl (or
any other language, really), and I can't see it.

I've got a block of code that I'd like to run in a loop until a user enters
some desired input.  My question is what control structure I should be using
for greatest efficiency and clarity?  What I'm using now is something like
this:

while () {
     if ($input = 'this') {
          # Do some things.
          last;
     }
     elsif ($input = 'that') {
          # Do some other things.
           last;
     }
     else {
          print "The original directions again.\n";
          chomp ($input = <STDIN>);
     }

Keeping the conditional statement empty and using last gets the job done,
although I know it's not right (even if it is effective).  Can someone nudge
me in the right direction?

-Owen.

Reply via email to