| [reply] |
ok, thanks,
1) basically open file "data" which contains 2 columns of numerical data approx 400 lines. Copy this data to another file "complete"
e.g. file "complete"
0 1
1 0
1 0
e.g. file data
0.521 0.365
0.258 0.456
0.211 0.912
so output would be:
0 1 0.521 0.365
1 0 0.258 0.456
1 0 0.211 0.912
thanks,
| [reply] [d/l] |
chomp( my @file1 = do { open FH, (+shift); <FH> } );
chomp( my @file2 = do { open FH, (+shift); <FH> } );
my @file3;
while( @file1 && @file2)
{
push @file3, join(' ', shift(@file1), shift(@file2));
}
open FH, ">output";
print FH join($/, @file3, '');
close FH;
Of course, you're going to want to add some error-handling for the file operations.
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
I shouldn't have to say this, but any code, unless otherwise stated, is untested
| [reply] [d/l] |