Guest User

Untitled

a guest
Jul 23rd, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. привет дядя ваня;
  2. пока дядя ваня;
  3. здравствуй дядя ваня;
  4.  
  5. милиция хорошо
  6. полиция хорошо
  7. пожарники хорошо
  8.  
  9. привет дядя ваня;милиция хорошо
  10. пока дядя ваня;полиция хорошо
  11. здравствуй дядя ваня;пожарники хорошо
  12.  
  13. #!/usr/bin/perl
  14. open(my $big,"<","big.txt") || die 'no big.txt';
  15. for(sort {($a=~/(d+)/)[0]<=>($b=~/(d+)/)[0]} grep {/^[012]?d.txt$/} <*.txt>) {
  16. open(my $fl,"<",$_);
  17. open(STDOUT,">",$_.".new");
  18. for(<$fl>) {
  19. chomp(my $l=<$big>);
  20. print "$l$_";
  21. }
  22. }
  23.  
  24. #!/usr/bin/env perl
  25.  
  26. my @file_names = ('1.txt', '2.txt');
  27. my $big_file_name = 'big.txt';
  28.  
  29. open(my $big_file, '<', $big_file_name) or die $!;
  30. for (@file_names) {
  31. open(my $file, '+<', $_) or die $!;
  32. my $content = "";
  33. for (<$file>) {
  34. chomp(my $s = <$big_file>);
  35. $content .= $s . $_;
  36. }
  37. seek($file, 0, 0);
  38. print $file $content;
  39. close($file);
  40. }
  41. close($big_file);
Add Comment
Please, Sign In to add comment