ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Array-Heap/Heap.pm
(Generate patch)

Comparing Array-Heap/Heap.pm (file contents):
Revision 1.7 by root, Mon Oct 27 22:33:50 2014 UTC vs.
Revision 1.8 by root, Tue Jul 14 23:28:10 2015 UTC

28=cut 28=cut
29 29
30package Array::Heap; 30package Array::Heap;
31 31
32BEGIN { 32BEGIN {
33 $VERSION = 3.1; 33 $VERSION = 3.2;
34 34
35 require XSLoader; 35 require XSLoader;
36 XSLoader::load ("Array::Heap", $VERSION); 36 XSLoader::load ("Array::Heap", $VERSION);
37} 37}
38 38
160will sort according to the first element of the arrays, i.e. C<1,2,3>. 160will sort according to the first element of the arrays, i.e. C<1,2,3>.
161 161
162The custom comparison functions work similar to how C<sort> works: C<$a> 162The custom comparison functions work similar to how C<sort> works: C<$a>
163and C<$b> are set to the elements to be compared, and the result should be 163and C<$b> are set to the elements to be compared, and the result should be
164greater than zero then $a is greater than $b, C<0> otherwise. This means 164greater than zero then $a is greater than $b, C<0> otherwise. This means
165that you cna use the same function as for sorting the array, but you could 165that you can use the same function as for sorting the array, but you could
166also use a simpler function that just does C<< $a > $b >>. 166also use a simpler function that just does C<< $a > $b >>.
167 167
168The first example above corresponds to this comparison "function": 168The first example above corresponds to this comparison "function":
169 169
170 { $a <=> $b } 170 { $a <=> $b }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines