Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- привет дядя ваня;
- пока дядя ваня;
- здравствуй дядя ваня;
- милиция хорошо
- полиция хорошо
- пожарники хорошо
- привет дядя ваня;милиция хорошо
- пока дядя ваня;полиция хорошо
- здравствуй дядя ваня;пожарники хорошо
- #!/usr/bin/perl
- open(my $big,"<","big.txt") || die 'no big.txt';
- for(sort {($a=~/(d+)/)[0]<=>($b=~/(d+)/)[0]} grep {/^[012]?d.txt$/} <*.txt>) {
- open(my $fl,"<",$_);
- open(STDOUT,">",$_.".new");
- for(<$fl>) {
- chomp(my $l=<$big>);
- print "$l$_";
- }
- }
- #!/usr/bin/env perl
- my @file_names = ('1.txt', '2.txt');
- my $big_file_name = 'big.txt';
- open(my $big_file, '<', $big_file_name) or die $!;
- for (@file_names) {
- open(my $file, '+<', $_) or die $!;
- my $content = "";
- for (<$file>) {
- chomp(my $s = <$big_file>);
- $content .= $s . $_;
- }
- seek($file, 0, 0);
- print $file $content;
- close($file);
- }
- close($big_file);
Add Comment
Please, Sign In to add comment