in reply to Re: Re: combine multiple files into one (line by line)
in thread combine multiple files into one (line by line)
#!/usr/bin/perl -w use strict; use IO::File; #interleave files, first argument is line count, rest are files. my $lc = shift; my @fhs; foreach (@ARGV) { my $fh = new IO::File; open ($fh, "<$_"); push @fhs, $fh; } while (--$lc) { foreach (@fhs) { print scalar(<$_>); } }
Tested minimally but the path is clear from here I hope.
--
$you = new YOU;
honk() if $you->love(perl)
|
|---|