Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^4: Form Stopped working

by kennethk (Abbot)
on Apr 04, 2017 at 16:51 UTC ( #1187019=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1187019]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2017-10-21 02:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (269 votes). Check out past polls.

    Notices?