Anonymous user
Sort a list of object identifiers: Difference between revisions
→{{header|Perl 6}}: add shorter solution
m (added whitespace before the TOC (table of contents), added a ;Task: (bold) header.) |
(→{{header|Perl 6}}: add shorter solution) |
||
Line 506:
>;</lang>
<lang Perl6>use Sort::Naturally;▼
.say for sort { .&naturally }, <▼
>;</lang>▼
{{out}}
<pre>.1.3.6.1.4.1.11.2.17.19.2.0.9
Line 548 ⟶ 525:
.1.3.6.1.4.1.11150.3.4.0.11
.1.3.6.1.4.1.11150.3.4.0.21</pre>
Alternatively, more golfed:
<lang Perl6>.say for sort *.split('.')».Int, <
...
▲>;</lang>
Or if using a third-party module is acceptable ''(input elided)'':
▲<lang Perl6>use Sort::Naturally;
...
>;</lang>
=={{header|REXX}}==
|