From: Joey Gibson Date: 2003-09-19T22:59:04+09:00 Subject: Re: Removing "nil" entries from array On 9/19/2003 9:54 AM, Thomas Adam wrote: >...yet I re-ran my program using the same data file (unchanged) and now my >array is being intermittently populated with "nil" values. Using "uniq()" >doesn't remove them. Any ideas? > > What about using delete_if? a = [:foo, nil, :bar, :baz, nil, nil, "testing"] a.delete_if {|x| x == nil} => [:foo, :bar, :baz, "testing"] delete_if modifies the array in place. If you want non-destuctive, use "reject" instead. -- Dean saor, dean saor an spiorad. Is seinn d'orain beo. http://www.joeygibson.com http://www.joeygibson.com/blog/life/Wisdom.html