Hi --

On Wed, 7 Aug 2002, Park Heesob wrote:

> $/ = nil
> foo = gets.split("\n")
> r = /^([a-z]+)([0-9]+)$/
> foo = foo.sort {|a,b| c,d = r.match(a)[1,2]
>                       e,f = r.match(b)[1,2]
>                       (c <=> e).nonzero? || d.to_i <=> f.to_i}
> puts foo

It's odd (to me) that #nonzero? doesn't return true or false, a fact I
wasn't aware of until looking at this (and wondering why it worked :-)


David

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