On Tue, 2 Jan 2001, GOTO Kentaro wrote:

> In message "[ruby-talk:8469] Re: A newbie question (about regexp)"
>     on 01/01/02, David Alan Black <dblack / candle.superlink.net> writes:
> >>   str = gets
> >>   break if not str
> >>   str.chop!
> >
> >That doesn't do what I think you think it does. Empty strings (let
> >alone ones with newlines in them :-)  are not false in Ruby.
> >
> >Try this:
> >
> >  str = gets.chomp
> >  break if str.empty?
> 
> It doesn't preserve the specification bacause original version is 
> intended to be quit by hitting `ctrl-d' ;-)

Whoops -- thanks.  


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav