Just change the entire for loop to this:
foreach (qw(0 3 8 20)) {
my ($word2) = split(/ /, $lines2[$_]);
my ($word3) = split(/ /, $lines3[$_]);
print "$lines1[$_]:$word2:$word3\n";
}
Just substitute the desired line numbers (each one -1, remember)
inside qw().
If you do have large data files, use gryng's method
below.
To grying: sorry for making you gag, I am studying
your method closely to make up for it. |