What happens if they don't have the same number of lines?
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
In reply to Re^11: inserting array of data into text file
by dragonchild
in thread inserting array of data into text file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |