$ raku -e '.say for <afoo12 afoo2>.sort(*.split(/\d+/, :kv).map({ (try 
.Numeric) // $_}).List)
afoo2
afoo12


> On 2 Mar 2024, at 07:26, ToddAndMargo via perl6-users <perl6-users@perl.org> 
> wrote:
> 
> Hi All,
> 
> @Sorted_List = @Sorted_List.sort: { .comb(/ \d+ | \D+ /) .map({ .Int // .self 
> })};
> 
> gives me
> 
>   Element [0]  <D:\MyDocsBackup\backup1>
>   Element [1]  <D:\MyDocsBackup\backup10>
>   Element [2]  <D:\MyDocsBackup\backup2>
>   Element [3]  <D:\MyDocsBackup\backup3>
>   Element [4]  <D:\MyDocsBackup\backup4>
>   Element [5]  <D:\MyDocsBackup\backup5>
>   Element [6]  <D:\MyDocsBackup\backup6>
>   Element [7]  <D:\MyDocsBackup\backup7>
>   Element [8]  <D:\MyDocsBackup\backup8>
>   Element [9]  <D:\MyDocsBackup\backup9>
> 
> I need it to say
> 
>   Element [0]  <D:\MyDocsBackup\backup1>
>   Element [1]  <D:\MyDocsBackup\backup2>
>   Element [2]  <D:\MyDocsBackup\backup3>
>   Element [3]  <D:\MyDocsBackup\backup4>
>   Element [4]  <D:\MyDocsBackup\backup5>
>   Element [5]  <D:\MyDocsBackup\backup6>
>   Element [6]  <D:\MyDocsBackup\backup7>
>   Element [7]  <D:\MyDocsBackup\backup8>
>   Element [8]  <D:\MyDocsBackup\backup9>
>   Element [9]  <D:\MyDocsBackup\backup10>
> 
> What did I goof up, this time?
> 
> Many thanks,
> -T

Reply via email to