Browse - Programming Tips - Perl: How can I do a case-insensitive sort?

Date: 2012mar20
Language: perl

Q.  Perl: How can I do a case-insensitive sort?

A.  

sub sortNoCase(@) { my(@a) = @_; return sort {lc $a cmp lc $b} @a; } # Example use: @sorted = sortNoCase(@messy);