3 Einträge, 1 Seite |
1
2
3
4
5
6
7
# my $file1 = `cat file`;
my $file1; {
open(my $fh, "< file") or die "Unable to open file: $!\n";
local $/;
$file1 = <$fh>;
}
$file1 =~ s!^(.*#REPLACE)(.*)$!$1$file2!e;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
my $file1 = '/path/to/file/one';
my $file2 = '/path/to/file/two';
open FILE1, $file1 or die $!;
my @content1 = <FILE1>;
close FILE1;
open FILE1, '>'.$file1 or die $!;
foreach my $line (@content1) {
if ($line =~ m~^(.*#REPLACE)~) {
open FILE2, $file2 or die $!;
print FILE1 $1,(<FILE2>);
close FILE2;
last;
}
print FILE1 $line;
}
close FILE1;
3 Einträge, 1 Seite |