Perl help please!

I want to write text to a file, but i want it inserted at a specific spot in the file. How would this be best performed? I want to insert this text:

DAEMON_OPTIONS(`Name=NoMTA4, Family=inet, Addr=127.0.0.1')dnl
FEATURE(`no_default_msa')dnl

Inserted into this file below , anywhere before the MAILER() section.

# If you want to customize this further, copy it to a name appropriate
# for your environment and do the modifications there.
#

divert(0)dnl
VERSIONID(`@(#)subsidiary.mc 1.11 (Sun) 03/27/06')
OSTYPE(`solaris8')dnl
DOMAIN(`solaris-generic')dnl
define(`confFALLBACK_SMARTHOST', `mailhost$?m.$m$.')dnl
MAILER(`local')dnl
MAILER(`smtp')dnl

I've seen methods to create a new file and to append, but not insert in the middle. (i'm new to perl, taking a class and trying to put it to practical use).
I'm trying to automate the disabling of incoming email.

Thanks, if anyone can help.

Create a new file, write the first few lines of the old file to the new file, then write your new strings, then write the last lines of the old to the new.