| Array-Sort documentation | view source | Contained in the Array-Sort distribution. |
Array::Parallel - Sorting Parallel Arrays
This document describes version 0.01 of Array::Parallel, released January 2004
use Array::Parallel;
@your_ratings = (2, 3, 1);
@husbands = ('fred', 'archie', 'homer');
@wives = ('wilma', 'edith', 'marge');
$array = Array::Parallel->new(\@your_ratings, \@husbands, \@wives);
($your_ratings, $husbands, $wives) = $array->sort('num');
for my $num ( (0 .. $#{@{$your_ratings}} ) ) {
print "You rated $husbands->[$num] and $wives->[$num] number $your_ratings->[$num]\n";
}
Does Parallel Array sorting. Sorting 1 Array and then matching up the keys from the first one to sort a second array, third array, ect. Take a look at the Synopsis if you are confussed about what I mean.
A more efficent way would be to use hash keys instead of using this module. But, this might be good for a lot of cases. I would test this module with the extremes of what data you expect before trusting it though.
Just two methods for now
Just the constuctor Usage: $a = Array::Parallel->new(\@sorted_array, \@next, ..);
Sorts arrays to first array. Returns references to all arrays supplied. Takes 1 arguement. Either "num" to sort $a <=> $b, and "cmp" to sort $a cmp $b
Usage: ($sorted_array, $next, ..) = $a->sort("num");
OO Nothing
Version .01 - Everythins new. Functions are: new (constructor) and sort/parasort. Probably bugy. I wouldn't trust it for important things.
Unknown, but they're there.
Please use the Module RIGHT. Not much in way of error messenging (well, not error messenging actually). As long as you give it arrays of equal length it won't freak out. If it doesn't work right tell me. This is a beta for a reason.
They call this version .01 for a reason. I have to do a lot. Contribution will be well accepted :-)
Will Gunther <lt>williamgunther@aol.com<gt>
perl.
| Array-Sort documentation | view source | Contained in the Array-Sort distribution. |