#If SUBROUTINE is omitted, the sort is in string comparison order.
#If SUBROUTINE is specified, the first argument to sort is the name of the subroutine, followed by a list of values to be sorted.
#To sort data according to a locale, include the use locale pragma.
#Format:
#sort(SUBROUTINE LIST)
#sort(LIST)
#sort SUBROUTINE LIST
#sort LIST
# Simple alphabetic sort
@list=("Abc","Bcd", "Cde","Def" );
print "Original list: @list\n";
@sorted = sort(@list);
print "Ascii sort: @sorted\n";
# Reversed alphabetic sort
@sorted = reverse(sort(@list));
print "Reversed Ascii sort: @sorted\n";
|