Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Schwartzian transform deformed with impunity

by salva (Abbot)
on Apr 23, 2012 at 08:58 UTC ( #966552=note: print w/ replies, xml ) Need Help??


in reply to Schwartzian transform deformed with impunity

going "no warnings" of course is not an option for me

Why not? there is nothing wrong in disabling them, at least if you know why they are happening:

@sorted = map{ $_->[0]} sort{ no warnings 'numeric'; $a->[2] <=> $b->[2] } map{[$_, split/sequence/]} @unsorted;

However, for this particular case and as already stated in other monks answers, it is easier to extract just the number.

Besides that, if you are concerned about the sort performance, you should try Sort::Key and Sort::Key::Radix:

use Sort::Key::Radix 'ukeysort'; my @sorted = ukeysort { /(\d+)/; $1 } @unsorted;


Comment on Re: Schwartzian transform deformed with impunity
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2015-07-28 18:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (258 votes), past polls