in reply to nested loops problem

Use a while loop around the part you want repeated. So in your case I would use:
while ($choice) { print STDOUT "\nPlease select the catergory of results that you wi +sh to see;\n\n\t1. tv \n\t2. computers \n\t3. exercise \n\t4. food\n\ +n"; chomp ($choice = <STDIN>); # # your code goes here # }
Using this method if the user entered nothing the program would exit.
Good luck with your project!

~~rob
____________________________________________________________
eval pack "h*", "072796e647022245d445f475454494c5e622b3";

Replies are listed 'Best First'.
Re: Re: nested loops problem
by Anonymous Monk on Jun 11, 2002 at 16:21 UTC
    in theory rOb's suggestion should work but it doesn't! the value of choice is not yey known at this point, also with this additional while loop , the other while loop is dismissed - non of the questions ar easked to the user
      Thanks for pointing that out. What I should have said was:
      do { print STDOUT "\nPlease select the catergory of results that you wi +sh to see;\n\n\t1. tv \n\t2. computers \n\t3. exercise \n\t4. food\n\ +n"; chomp ($choice = <STDIN>); # # your code goes here # } while ($choice)

      ~~rob
      ____________________________________________________________
      eval pack "h*", "072796e647022245d445f475454494c5e622b3";