I need to read from File1 and File2, and write the first row in file1 + first row in file2 in file3.
if file1 ends before file2, then the program is finnished,
if file2 ends before file1 then it should begin from the beginning untill file 1 ends,
the code I have now is not complete. can you please help me to finnish it ?
thanx.
Expand|Select|Wrap|Line Numbers
- #!/usr/bin/perl
- open(file1, "SA2007");
- open(file2, "INTJ2005");
- open(file3, ">INTJ2006.del");
- while (!(eof(file1)) {
- if((eof(file2)){
- #go to begining of file (how to do that ?
- }
- else{
- # copy first row of file1 > $fr1
- # copy first row of file2 > $fr2
- # print "$fr1:$fr2" > file3
- }
- }
- close file1;
- close file2;
- close file3;