http://qs321.pair.com?node_id=1187019


in reply to Re^3: Form Stopped working
in thread Form Stopped working

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 <customerservice@df-foods.com>'; my $emailCC = 'Frank Simmons <fsimmons@oregonpotato.com,susan@ftiegs.c +om,jenbrink@icloud.com>'; my $emailFrom = FilterCChars($FTGEmail); open(my $mail,'|-', $mailProg) or die "Problem accessing $mailProg: $! +"; print $mail <<EOT; To: $emailTo Cc: $emailCC From: $emailFrom Subject: $emailSubject Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit $emailBody EOT close $mail; # Redirect user to success page print "Location: /thankyou.html\n\n"; exit;
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.