On Wed, 20 Feb 2002, Jon Lapham wrote:
...
>
> What I would like to to return the tuples in this order:
> A
> B
> C
> ...
> X
> Y
> Z
> AA
> AB
> ...
>
> Instead of:
> A
> AA
> AB
> ...
> B
> BA
> BB
In Perl you can do it with 3 lines of code. Consider the example
below:
#!/usr/bin/perl -w
use strict;
my @testset = ( 'A'..'Z' );
push @testset, ( 'AA'..'ZZ' );
for ( sort @testset ) {
print "DEFAULT ORDERING: $_\n";
}
for ( sort { length($a) <=> length($b)
||
$a cmp $b } @testset ) {
print "ORDERING USER DEFINED: $_\n";
}
;-)))
Best regards
Herbie
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Herbert Liechti http://www.thinx.ch
ThinX networked business services Adlergasse 5, CH-4500 Solothurn
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~