Tony De wrote:
> Christian wrote:
>> Does the sort work if you just put in the sourceip? Say, you did 
>> @results <<
>> "#{sourceip}", and then used @results.sort. Does it still not sort?
>> 
>> On Sat, Mar 29, 2008 at 4:14 PM, Tony De <tonydema / gmail.com> wrote:
>> 
>>> >>
>>> > cigar,
>>> --
>>> Posted via http://www.ruby-forum.com/.
>>>
>>>
>> 
>> 
>> --
>> 
>> "Every child has many wishes. Some include a wallet, two chicks and a 
>> cigar,
>> but that's another story."
> 
> Yeah, if I only collect the "sourceip" and do a @results.sort it doesn't 
> work.  I have to do a .sort!.  And the same behaviour with @results << 
> ["#{file}", "#{sourceip}", "#{email}", "#{subject}"].  @results.sort 
> does not sort.  @results.sort! does.  And I tried sort! as an after 
> thought.
> 
> tonyd

"as an after thought" got me to thinking.  Try @results.sort! {|x, y| 
y[1] <=> x[1]}.  And it works.  .sort fails, .sort! works.  Any ideas 
why?  I would really like to understand this a little more.  Thanks 
guys, all of you, for your help.

tonyd
-- 
Posted via http://www.ruby-forum.com/.