Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: How can I do a numeric sort on a substring?

by haukex (Bishop)
on Jun 25, 2021 at 14:07 UTC ( #11134278=note: print w/replies, xml ) Need Help??


in reply to Re^2: How can I do a numeric sort on a substring?
in thread How can I do a numeric sort on a substring?

in case there are more than one number matching like a-1-3 ?

Do you mean something like Sort::Key::Natural? See also How do I do a natural sort on an array?

  • Comment on Re^3: How can I do a numeric sort on a substring?

Replies are listed 'Best First'.
Re^4: How can I do a numeric sort on a substring?
by LanX (Sage) on Jun 25, 2021 at 16:48 UTC
    Thanks for pointing to Sort::Key , seems it covers all use cases of the Schwartzian transform with a short syntax. :)

    The documentation could be simpler tho, by deconstructing the naming convention.

    [|r][|n|i|u]keysort[_inplace] @array

    (Like this the doc seem even to be not logical/ wrong in one case)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Re^4: How can I do a numeric sort on a substring?
by misterperl (Monk) on Jun 25, 2021 at 14:15 UTC
    sort key natural IS DA BOMB!! TY TY this made my week :)
Re^4: How can I do a numeric sort on a substring?
by misterperl (Monk) on Jun 25, 2021 at 14:09 UTC
    I never saw that Natural sort- you are on fire today all ++ votes! TYVM Have a great weekend- I'm headed off to study your suggestions..
      For an even more general sort, see the function 'sort_by' in List::UtilsBy.
      Bill
        No, no!!!

        Sort::Key family of modules is far more general and flexible than List::UtilsBy::sort_by!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11134278]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2021-09-28 05:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?