A subroutine [perldoc.com] is a chunk of code inside your CGI script to perform common tasks. You are already sending one email to yourself, now you want to send one to the form submitter. Seems like a logical place to use a function.
More resources:
Can I pass variables to a perl subroutine this way [webmasterworld.com]