I am using:
@sorted = sort { $a cmp $b } @unsorted;
To sort table elements alphabetically, but when I sort things like:
z
zzz
aaaa
bbb
I become:
aaaa
bbb
z
zzz
Is there a way to make string length a higher priority than the sequence of letters in alphabet, and get result like:
z
bbb
zzz
aaaa
@sorted = sort { $a cmp $b } @unsorted;
To sort table elements alphabetically, but when I sort things like:
z
zzz
aaaa
bbb
I become:
aaaa
bbb
z
zzz
Is there a way to make string length a higher priority than the sequence of letters in alphabet, and get result like:
z
bbb
zzz
aaaa