in reply to Re: noncase-sensitive sorting
in thread noncase-sensitive sorting
The first map expands the original string with a 0 terminated string of width $max_l, concatinated with the original string itself. Eliminates the use of a slice in the Schwartzian sort.@grt_sorted = map {substr $_ => $max_l} sort map {uc () . ("\0" x ($max_l - length)) . $_} @array;
map { my $c = uc () . ("\0" x ($max_l - length)) . $_; print "$_ => $c\n"; $c } @array;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: noncase-sensitive sorting
by Abigail-II (Bishop) on Dec 02, 2003 at 12:46 UTC |