Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Golf: Arbitrary Alphabetical Sorting

by ChemBoy (Priest)
on May 09, 2001 at 20:42 UTC ( #79151=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub o {
    $q=join'',@{$_[0]};
    sort {$i=0;
    {index($q,substr($a,$i,1))<=>index($q,substr($b,$i,1))or($i++,redo)}}@
    +{$_[1]}
    }
    
  2. or download this
    sub o {
    $q=join'',@{$_[0]};
    sort {$a cmp$b?do{$i=0;{index($q,substr($a,$i,1))<=>index($q,substr($b
    +,$i,1))or($i++,redo)}}:0
    }@{$_[1]}
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://79151]
help
Chatterbox?
[Corion]: Weird. this documentation says what you say.
[Corion]: I assume you are experiencing this with your packaged program. Maybe also include PerlApp.pm in the packaging list?
[james28909]: has anyone else run into this problem? i have tried searching but have not returned many results
[james28909]: ah, good idea.
[Corion]: What does print $PerlApp::VERSION output?

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2017-07-28 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (429 votes). Check out past polls.