in reply to reverse sort arrays in subroutines

Are you trying to sort in descending order?

If so, you have a couple of choices. One, you can use a custom sort routine, eg:

my @SortedArray = sort { $b cmp $a } @PassedArray;

...or two, you can reverse the output of sort:

my @SortedArray = reverse sort @PassedArray;

The point I'm making is that reverse will act upon the sorted list. The way you have it, sort is acting upon a reversed list, which is incorrect. I hope I'm not missing your point. :) If that's not what you're asking, please clarify.

By the way, this isn't C++98 (vector.push_back()), you can populate your @TaR array like this: @TaR = ( 8, 2, 5, 4, 5, 6, 1, 8 ); ... and STDOUT is the default for print, so you don't usually need to explicitly mention it.


Dave