For situations where you have a stream of lines, a here-doc
can significantly improve readability. As well, a two-argument open without a check is considered bad practice. Combining all this with a lexical filehandle and poj
's suggestion, I might write your script as:
my $emailTo = 'Customer Service <email@example.com>';
my $emailCC = 'Frank Simmons <firstname.lastname@example.org,email@example.com
my $emailFrom = FilterCChars($FTGEmail);
open(my $mail,'|-', $mailProg) or die "Problem accessing $mailProg: $!
print $mail <<EOT;
Content-Type: text/plain; charset="UTF-8"
# Redirect user to success page
print "Location: /thankyou.html\n\n";
Note how much cleaner that looks without all the newlines and print commands.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.