From: Rob Biedenharn Date: 2007-10-05T08:47:42+09:00 Subject: Re: Add files to array matching pattern On Oct 4, 2007, at 7:35 PM, Leon Bogaert wrote: > This would work: > > i = 0; dir = "/home/leon/"; test = Array.new; test = > Dir.new(dir).entries.map! { |x| x =~ /filezilla$/ ? x : next }; > test.compact > > Is the .compact needed? Can't I get rid of that? test = Dir.entries("/home/leon").grep(/filezilla$/) -Rob Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com