in reply to read column in perl
Only one loop is needed.
#!/bin/perl open(IN, "file1"); open(IN2, "file2"); open(OUT, "> output"); while ($str = <IN>) { chomp($str); $data = <IN2>; chomp($data); @box = split(/\s+/, $data); splice(@box, 1, 0, $str); print OUT (join(' ', @box) . "\n"); }
|
|---|