From: Julian Gall Date: 2006-03-04T03:12:45+09:00 Subject: Re: Array comparison returning nil Stephen Waits wrote: > Maybe you could post an irb session of your own so we could see > what's happening? Not really possible. I am writing a Rails application with a sortable list on a web page. An XML_Http_request serialises the ids of the list items and POSTs them to my action controller. By the time I see this data it is an array of identifiers (numbers) in params[:itemlist]. I extract this to a local array with: new_item_ids = [] params[:itemlist].each {|item| new_item_ids << item} I want to compare this with another local array of my original (unsorted) identifiers. i.e. original_item_ids.sort <=> new_item_ids.sort This doesn't work, although this does: original_item_ids.sort.join('-') == new_item_ids.sort.join('-') It is odd that join works to produce the expected string where <=> thinks it has a problem. Julian -- Posted via http://www.ruby-forum.com/.