in reply to How do you alphabetize an array?
in thread Answer: How do you alphabetize an array?
my @unsorted = qw/Maggie Bart Lisa Homer Marge/; my @sorted = sort @unsorted;
To sort case-insensitively, just change the second line to this:
my @sorted = sort { lc($a) cmp lc($b) } @unsorted;
See sort for a complete explanation.
|
|---|