in reply to Re: ending this loop
in thread ending this loop

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

Replies are listed 'Best First'.
Re: Re: Re: ending this loop
by suaveant (Parson) on Aug 10, 2001 at 21:07 UTC
    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

Re: Re: Re: ending this loop
by John M. Dlugosz (Monsignor) on Aug 10, 2001 at 22:26 UTC
    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"; }