in reply to Issue merging 2 log files.

If the log files are already sorted (sometimes they are not fully sorted), you can read and merge them on the fly.

There are several CPAN modules that allow you to do so: merge

use Sort::Key::Merger qw(filekeymerger); my $merger = filekeymerger { chomp; return undef if /^#/; make_sorting_key($_) } @filenames; while (defined(my $line = $merger->())) { whatever($line); }
You can also use Sort::External.