1 |
Mark David Dumlao wrote: |
2 |
> When ordering items by name, a separate and distinct sequence is scene |
3 |
> for A-Z before the sequence for a-z. This is the expected behavior. What |
4 |
> might i need to look up to intermix [Aa]-[Zz]? |
5 |
|
6 |
|
7 |
Schwartzian Transform is the perlish version of a |
8 |
technique from LISP: create a compound structure |
9 |
with the output as payload: |
10 |
|
11 |
my @sorted |
12 |
= map |
13 |
{ |
14 |
$_->[-1] |
15 |
} |
16 |
sort |
17 |
{ |
18 |
$a->[0] cmp $b->[0] |
19 |
} |
20 |
map |
21 |
{ |
22 |
my $sortval = uc $_; |
23 |
|
24 |
[ $sortval, $_ ] |
25 |
} |
26 |
@unsorted_text; |
27 |
|
28 |
You can use the basic technique to sort anything |
29 |
(multi-level sorts, numeric, whatever). Same basic |
30 |
process works in other languages that support anon |
31 |
arrays or structs. |
32 |
|
33 |
|
34 |
-- |
35 |
Steven Lembark 85-09 90th St. |
36 |
Workhorse Computing Woodhaven, NY, 11421 |
37 |
lembark@×××××××.com +1 888 359 3508 |