From: Nathan Olberding Date: 2006-04-06T05:40:50+09:00 Subject: Re: Comparing Arrays Mark Volkmann wrote: > I got bit by something similar this past weekend. It turns out that > Array#delete deletes based on == comparisons (generally means two > objects are from the same class and have the same instance variable > values), not eql? comparisons (means same object) as I had guessed. > That can be a significant difference. For one thing it allows the > delete method to delete more than one object from the array. If you > want to delete a specific object based on its identity, as far as I > know you need to do it like this. > > obj_to_delete = whatever > my_array.delete_if { |obj| obj.eql?(obj_to_delete) } That sounds like something not many people would assume, and therefor maybe something that might be reviewed before 2.0... but anyways! The list1 - list2 way of doing this worked wonders. Funny, I used this two weeks ago, the last time I hacked on this script, and had completely forgotten about it. Many thanks to everyone! As an aside, is_this the ruby naming convention, orThis? All the references I've seen on the web useThis. Either is fine, I'm just wondering now that it's been brought up. -- Posted via http://www.ruby-forum.com/.