in reply to Merging files, 1 line for every 10
Say that you read each file into an array.
use File::Slurp; my @file1 = read_file('file1'); my @file2 = read_file('file2');
Where would you go from there? Eventually you could have a new array, write it out like this:
my $lines = merge_lines(\@file1, \@file2); write_file('file3', @$lines);
How would you write 'merge_lines'?
sub merge_lines { my ($lines1, $lines2) = @_; my @lines; .... return \@lines; }
Not the most efficient way to do it, but...
|
|---|