Guest User

Untitled

a guest
Jan 23rd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #!/usr/bin/perl
  2. # copy contents of 2 files alternatively to another file
  3. $input1 = 'f1.txt';
  4. $input2 = 'f2.txt';
  5. open (my $j, '<' , $input1 );
  6. open (my $l, '<' , $input2 );
  7. open (my $k, '>', 'f3.txt' );
  8. while (<$j>){
  9. print $k $_; # $_ is used to print the line till the end.
  10. while(<$l>){
  11. print $k $_;
  12. last;
  13. }}
  14. close $k;
  15. close $j;
  16. close $l;
Add Comment
Please, Sign In to add comment