# 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;