There's more than one way to do things PerlMonks

### Re (tilly) 1: Golf: Arbitrary Alphabetical Sorting

by tilly (Archbishop)
 on May 09, 2001 at 21:30 UTC ( #79177=note: print w/replies, xml ) Need Help??

```sub o{
(\$c,\$s)=@_;@m{@\$c}=map{10*@\$c+\$_}0..@\$c;sub t{\$_=pop;s/./\$m{\$&}/gs;\$_}
+sort{t(\$a)cmp t(\$b)}@\$s
}
```
```sub o{
(\$c,\$s)=@_;@m{@\$c}=map{\$_+9999}1..@\$c;sub t{\$_=pop;s/./\$m{\$&}/gs;\$_}so
+rt{t(\$a)cmp t(\$b)}@\$s
}
```
```sub o{
(\$c,\$s)=@_;@m{@\$c}=map\$_+9**9,1..@\$c;sub t{\$_=pop;s/./\$m{\$&}/gs;\$_}sor
+t{t(\$a)cmp t\$b}@\$s
}
```
```sub o{
(\$c,\$s)=@_;@m{@\$c}=map\$_+1e9,1..@\$c;sub t{\$_=pop;s/./\$m{\$&}/gs;\$_}sort
+{t(\$a)cmp t\$b}@\$s
}
```
```sub o{
(\$c,\$s)=@_;@m{@\$c}=map\$_+~0,1..@\$c;sub t{\$_=pop;s/./\$m{\$&}/gs;\$_}sort{
+t(\$a)cmp t\$b}@\$s
}
```
```sub o{
(\$c,\$s)=@_;@m{@\$c}=1e8..@\$c+1e8;sub t{\$_=pop;s/./\$m{\$&}/gs;\$_}sort{t(\$
+a)cmp t\$b}@\$s
}
```

Create A New User
Node Status?
node history
Node Type: note [id://79177]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2017-10-20 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My fridge is mostly full of:

Results (258 votes). Check out past polls.

Notices?