From: Thomas Leitner Date: 2004-10-06T18:19:55+09:00 Subject: Re: Upcase array On Wed, 6 Oct 2004 17:41:50 +0900 Fredrik Jagenheim wrote: | Given this array: | foo = %w { FOO BAR baz biz } | | How do I make all the entries uppercase in a short and readable way? | | The (to me) obvious solution won't work: | foo.map! { |x| x.upcase! } | as upcase returns nil if it doesn't have anything to upcase... | | //F | | Do not use x.upcase! but x.upcase (without the exclamation mark): irb(main):005:0> foo = %w{ FOO BAR baz biz } => ["FOO", "BAR", "baz", "biz"] irb(main):006:0> foo.map! { |x| x.upcase } => ["FOO", "BAR", "BAZ", "BIZ"] *hth*, Thomas