From: Simon Krahnke Date: 2008-05-26T16:34:36+09:00 Subject: Re: A simple newbie question (arrays and strings) * koichirose (22:51) schrieb: > yermej wrote: >> unique_array = Dir.entries('.')[2..-1].map {|f| f.split('-')[0]}.uniq >> string.map! {|f| f.split('-')[0]}.uniq! > > What if I do: > Dir.entries('.')[2..-1].map! {|f| f.split('-')[0]}.uniq > > with map! instead of map ? map! changes the array it's called on. since that is a temporary array returned by Dir.entries[2..-1] which is discarded after map! that won't work. mfg, simon .... l