my $input = 'existing.txt'; my $output = 'new.txt'; open ( my $in, '<', $input ) or die "Cannot open file $input for reading: $!\n"; open ( my $out, '>', $output ) or die "Cannot open file $output for writing: $!\n"; print $out "
\n";
while ( <$in> ) {
    print $out $_;
}
print $out "\n
\n"; close $out or warn "Error writing $output: $!\n"; close $in;