Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- # copy contents of 2 files alternatively to another file
- $input1 = 'f1.txt';
- $input2 = 'f2.txt';
- open (my $j, '<' , $input1 );
- open (my $l, '<' , $input2 );
- open (my $k, '>', 'f3.txt' );
- while (<$j>){
- print $k $_; # $_ is used to print the line till the end.
- while(<$l>){
- print $k $_;
- last;
- }}
- close $k;
- close $j;
- close $l;
Add Comment
Please, Sign In to add comment