Re: I need sorting help
[email protected] (Ralph Mellor)
| Newsgroups | perl.perl6.users |
|---|---|
| Message-ID | <CAPLR5SdtZEVmMujos=MB8Ln1fOZPrYb_z6tcsq6QZZkmvzxwVQ@mail.gmail.com> |
On Tue, Mar 5, 2024 at 7:01 AM ToddAndMargo via perl6-users <[email protected]> wrote: > >> $ raku -e '.say for <bk10 bk34 bk2 bk1>.sort(*.split(/\d+/, :kv).map({ (try .Numeric) // $_}).List)' > >> > >> Yippee! > > raku -e '.say for <bk10 bk34 bk2 bk1>.sort: { .comb(/ \d+ | \D+ /).map({ .Int // .self }).cache };' > > Awesome! Now I have two different methods! And now 4: $ raku -e '.say for <bk10 bk34 bk2 bk1>.sort: {m/ \d+ /.Int}' bk1 bk2 bk10 bk34 or, same logic, but spelled differently: $ raku -e '.say for <bk10 bk34 bk2 bk1>.sort: +*.match: / \d+ /' bk1 bk2 bk10 bk34 -- love, raiph