> -----Original Message-----
> From: Wendy DeCora [mailto:[EMAIL PROTECTED]]
> Sent: 23 August 2001 16:13
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: sendmail and newlines
> 
> 
> Situation:  My perl script (see Code: below) is being
> handed a flatfile (see File: below) generated from a
> database to do a mass mailing that will send a message
> generic to the flatfile but with each recepient
> receiving a unique username and password.
> The message part of the file is being input by a list
> administrator through an oracle tool (I think, I
> didn't develop that in anyway) and the ability to have
> newlines is necessary for formatting.  The problem is
> when this message is dumped into the flatfile, the
> newlines are still in it and cause the script to go
> nuts.
> 
> My idea was to have the newlines in the message
> replaced with \\n before being put into the flatfile
> (which is what I have done in my test file).  I then
> attempt to replace the \\n with \n in the $message
> field for sending.
> 
> It kind of works. (see Output: below) I get the
> newlines now, but i also get one \ just out there.  I
> have tried many variations, but having \\n and
> replacing with \n seems to be the only way to get a
> newline to work, but how to get rid of the extra \?
> 
> Any suggestions would be very very appreciated.
> TIA


Wendy 
        
>       $message =~ s|\\n|\n|g;  #replace the escaped newlines with newlines
for formatting
        

The \\n in your expression is using the first backslash as a logical escape
character to make it literally a backslash, not part of a (\n) pair. Use 

        
        $message =~ s|\\\\n|\n|g;  #replace the escaped newlines with
newlines for formatting
         
to represent the two backslashes in you input file

Hope this makes sense


Rod the IFFO
 
Mailto:[EMAIL PROTECTED]
Tel: +44-1293-584145
Mob: +44-7711-553080
Fax: +44-1293-584994

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to