RE: Tie::Array::SortedHi Simon and others, I agree that Tie::Array::Sorted is a good name.
>But it is a shocking ommission if there isnt at least one other way. I definately vote for > Tie::Array::Sorted, but It may be worth having a look at Tie::Hash::Sorted and make > them compatible on some level. And I agree that Tie::Array::Sorted should be compatible with Hash::Sorted in some level. But I wouldnīt like if Tie::Array worked just like Hash::Sorted because I donīt like it. With Hash::Sorted we still have to know that enigmatic sorting subroutine: my $sort_by_numeric_value = sub { # this sub sucks!! my $hash = shift; [ sort {$hash->{$b} <=> $hash->{$a}} keys %$hash ]; }; This is the difficult part that should be encapsulated, i think. I suggest that you implement something like an ORDER attribute with the values ASCENDING and DESCENDING, sparing us to know about that subroutine. like this: tie my @sorted_array, 'Tie::Array::Sorted', 'Array' => \ @unsorted_array, 'ORDER' => ASCENDING; Also, you could try to guess (via regexps) if the data to be sorted is numeric or alphabetical and use the appropriate subrouting to order it. But if you donīt think this is a good idea, you could add another attribute called TYPE with the values NUMERIC and ALPHABETICAL. see ya, bnegrao.