And this perl script:|decoraw@act.org|This is my message.\\nI hope these returns will work +this time.\\nWendy|http://www.act.org|3|3|
And I get this output in an email:#!/usr/bin/perl $mailprog = '/usr/sbin/sendmail -t'; $admin_email="decoraw\@act.org"; $subject="Testing the new mass mailer"; $file = "/actapps/suitespot/cgi-bin/sender/returntest3.txt"; $number_sent = 0; open(DATA, "$file") || die "Can't open $file"; # open the file for +reading while($line = <DATA>) { chomp $line; ($junk,$email,$message,$survey_url,$login,$password) = split(/\|/, +$line); $message =~ s|\\n|\n|g; #replace the escaped newlines with newlin +es for formatting open (MAIL, "|$mailprog -t") || die "Can't open $mailprog! \n"; print MAIL "Content-type:text/plain\n"; print MAIL "From: $admin_email\n"; print MAIL "To: $email\n"; print MAIL "Subject: $subject\n"; print MAIL "$message\n\n"; print MAIL "URL: $survey_url\n"; print MAIL "Login: $login\n"; print MAIL "Password: $password\n"; close(MAIL); $number_sent++; }
What is wrong with my regex $message =~ s|\\n|\n|g; #replace the escaped newlines with newlines for formatting that is causing the new lines to be inserted but one \ to remain? I've tried several variations on the regex, but this is the only one i've been able to actually get the newlines showup properly. TIA -WendyThis is my message.\ I hope these returns will work this time.\ Wendy URL: http://www.act.org Login: 3 Password: 3
In reply to escaping newlines, regex question by hmbscully
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |