Sort using a custom comparator: Difference between revisions
m
→{{header|Raku}}: simplified
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: sundry clean-up) |
SqrtNegInf (talk | contribs) m (→{{header|Raku}}: simplified) |
||
Line 3,132:
=={{header|Raku}}==
(formerly Perl 6)<br>
Primary sort by length of string, then break ties by sorting alphabetically (ignoring case).
<lang perl6>my @strings = <Here are some sample strings to be sorted>;
{{out}}
<pre>be to are Here some sample sorted strings
be to are Here some sample sorted strings
</pre>
▲say @sorted_strings = sort -> $x { [ $x.chars, $x.lc ] }, @strings;</lang>
=={{header|REXX}}==
|