1Sort::MergeSort(3) User Contributed Perl Documentation Sort::MergeSort(3)
2
3
4
6 Sort::MergeSort - merge pre-sorted input streams
7
9 use Sort::MergeSort;
10
11 my $terator = mergesort($comparefunc, @iterators);
12
14 Given a comparison function and a bunch of iterators that produce data
15 that is already sorted, "mergesort()" will provide an iterator that
16 produces sorted and merged data from all of the input iterators.
17
18 Sort::MergeSort also works with filehandles. It doesn't care. If
19 it's only input is a filehandle, it will return a filehandle. In all
20 other situations it will return an iterator.
21
22 The $comparefunc takes two arguments. It does not use the implicit $a
23 & $b that perl sort uses.
24
25 The iterators are treated as file handles so any filehandle or
26 Sort::MergeSort::Iterator will do as input.
27
29 use Sort::MergeSort;
30
32 Sort::MergeSort::Iterator
33
35 Copyright (C) 2008,2009 David Sharnoff. Copyright (C) 2013 Google,
36 Inc.
37
38 This package may be used and redistributed under the terms of either
39 the Artistic 2.0 or LGPL 2.1 license.
40
41
42
43perl v5.36.0 2022-07-22 Sort::MergeSort(3)