If we can make the assumption that each file has the same number of lines, then the following should work:
#!/usr/bin/perl -w use strict; my %files; my @infiles = qw(fileA fileB fileC); for (@infiles) { open IN, "<", $_ or die "Cannot open $_:$!\n"; chomp(@{$files{$_}} = <IN>); close IN; } open OUT, ">", "fileD" or die "Cannot open fileD:$!\n"; for my $line (0 .. $#{$files{fileA}}) { for my $file (@infiles) { print OUT $files{$file}[$line]; } print OUT "\n"; } close OUT;
$ cat fileD 111AAAaaa 222BBBbbb 333CCCccc
Darren :)

In reply to Re: parallel reading by McDarren
in thread parallel reading by azaria

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":