Category list operator (list) Arguments subname list Arguments block list Arguments list Return Value list
This function sorts the list specified and returns the sorted list. The sort method can be specified with the optional subroutine or block argument. A subroutine may be specified that takes two arguments (passed as global package variables, $a $b) and returns TRUE if the first is less than or equal to the second by any criteria used. Similarly, a block can be specified (effectively an anonymous subroutine) to perform this function. The default sort order is based on the standard string comparison order.
@a = ("z","w","r","i","b","a"); print("sort() ",sort(@a),"\n");
Originally posted as a Categorized Answer.
In reply to Re: Alphabetize Array
by lilphil
in thread How do you alphabetize an array?
by JohnMcPherson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |