in reply to Sorting Arrays Without using SORT function

PerlCool,
As you can probably tell, we believe your question to be homework which is very much frowned on if not acknowledged as such (and sometimes even then). It is perfectly possible that you want to know how sorting algorithms work and can't understand perl's source code written in C nor the myriad of explanations online. If that is the case, then make sure you say that.

Learning the pros and cons of merge sort in comparison to a bubble sort is worth pursuing in my opinion. For that reason I am going to give you the tools to write your own bubble sort and that should give you enough knowledge to explore more advanced sorting algorithms. If you get stuck and need help, make sure you are much more forthcoming with what you are doing and why (because I too think this is homework).

The cmp operator will compare two strings and tell you if they are equal or not. If they are not equal, it will tell you which one is greater than the other ASCIIbetically. You can swap the value of two array elements using the following syntax: ($list[0], $list[1]) = ($list[1], $list[0]); Now consider you are compare the first two elements of the list and they are out of order - just swap them. Next, compare the second element, if they are order, swap them. Repeat this process until you reach the end of the list. Start back at the beginning and continue until you go all the way through the list without swapping any elements - then you know it is in sorted order.

Cheers - L~R