From: Steve Peters Date: 2002-09-18T12:09:04+09:00 Subject: A newbie question for using sort I've been trying to use sort for an array and I seem to be missing something. Here's my code and results. #!/usr/local/bin/ruby arr = ["a", "G", "b", "f"] arr.sort print "Sort #1\n" for atom in arr print atom, "\n" end arr.sort { |x, y| y <=> x} print "\n\nSort #2\n" for atom in arr print atom, "\n" end [localhost:~/src/ruby] steve% ./dirsort.rb Sort #1 a G b f Sort #2 a G b f What I'm guessing is that the item I think is an array is not actually an array or the comparison is working the way I think it is supposed to. If anyone can let me know what I'm doing wrong, I'd appreciate it. Thanks, Steve