in reply to ending this loop

The last function will finish the current loop... and perlfunc:next|next] will immediately take you to the top and start the next iteration of the loop

                - Ant
                - Some of my best work - Fish Dinner

Replies are listed 'Best First'.
Re: Re: ending this loop
by jrbush82 (Initiate) on Aug 10, 2001 at 21:05 UTC
    Thanks, I got it working with this:
    while(<>){ if(/dick/){ print "you said dick!\n"; } else { print "you didn't say dick, hah, what a dick!\n"; } last; }
    Thanks again,
    jrbush82
      And if you did the following...
      while(<>){ if(/dick/){ print "you said dick!\n"; last; } else { print "you didn't say dick, hah, what a dick!\n"; } }
      it would keep waiting for input until it got 'dick'

                      - Ant
                      - Some of my best work - Fish Dinner

      That will always quit after the first pass. So why do you have a loop at all? If that "works", what you really want is just:
      $_= <>; if(/dick/){ print "you said dick!\n"; } else { print "you didn't say dick, hah, what a dick!\n"; }