From: Matt Gushee Date: 2002-10-03T07:55:45+09:00 Subject: Re: Can soneone tell me what I'm doing wrong... On Thu, Oct 03, 2002 at 07:50:02AM +0900, Matt Gushee wrote: > On Thu, Oct 03, 2002 at 07:44:12AM +0900, William Djaja Tjokroaminata wrote: > > > > If you ever used C++, then you would have known the issue of deleting an > > element while you are traversing the container using an iterator. > > And for those who haven't used C++ ... what is the issue? And does it > explain why the simpler method I was planning to suggest doesn't work > either? > > My suggestion was going to be: > > fileNames = mp3Dir.entries.collect {|f| f =~ /.*mp3$/} > > or something much like it. But no go. Oops! Never mind. 'collect' was the wrong method. This works: fileNames = mp3Dir.entries.find_all {|f| f =~ /.*mp3$/} -- Matt Gushee Englewood, Colorado, USA mgushee@havenrock.com http://www.havenrock.com/