Perl sort Function
This function sorts LIST according to the subroutine SUBNAME or the anonymous subroutine specified by BLOCK. If no SUBNAME or BLOCK is specified, then it sorts according to normal alphabetical sequence.
If BLOCK or SUBNAME is specified, then the subroutine should return an integer less than, greater than, or equal to zero, according to how the elements of the array are to be sorted
Following is the simple syntax for this function:
sort SUBNAME LIST sort BLOCK LIST sort LIST
This function returns sorted list.
Following is the example code showing its basic usage:
#!/usr/bin/perl -w @array = ("z", "w", "r", "i", "b", "a"); print("sort() ", sort(@array), "\n");
When above code is executed, it produced following result