in reply to Re: Re: Data Structures wanted; apply within.
in thread Data Structures wanted; apply within.

Thanks, but the power of the module is that it allows your to sort on any number of columns. For example:
first sort on substr($string, $foo0, $bar0), then
then sort on substr($string, $foo1, $bar1) , then
then sort on substr($string, $foo2, $bar2) , ... and so on.

Replies are listed 'Best First'.
Re: Re: Re: Re: Data Structures wanted; apply within.
by jeroenes (Priest) on Mar 09, 2001 at 22:49 UTC
    If you take a look at sort, you see that you can do something like
    sub deepsort { substr( $_[0], $p[0], $l[0]) cmp substr( $_[1], $p[0], $l[0] ) || substr( $_[0], $p[1], $l[1]) cmp substr( $_[1], $p[1], $l[1] ) || ....ad nauseum } @sorted = sort 'deepsort', @list;
    Of course it's better to build the deepsort from an eval and map.....

    Jeroen
    "We are not alone"(FZ)