NateTut has asked for the wisdom of the Perl Monks concerning the following question:
$doc->{Body} contains the text with the mixture of LFs & CRLFs. This is a WinDoze app so I'm sure print is putting CRLFs on the line ends.open (TEXTFILE, ">$subdir/message.txt") or die "Can't create $subdir message file: $!"; print TEXTFILE "From: ", $doc->{From}->[0]; print TEXTFILE "Subject: ", $doc->{Subject}->[0]; $doc->{Body} =~ s/\015/\n/gm; print TEXTFILE $doc->{Body}; close TEXTFILE;
The problem was that I was trying to modify a Lotus Notes Object. Kudos to diotalevi for that tip.open (TEXTFILE, ">$subdir/message.txt") or die "Can't create $subdir message file: $!"; print TEXTFILE "From: ", $doc->{From}->[0]; print TEXTFILE "Subject: ", $doc->{Subject}->[0]; my $NewBody = $doc->{Body}; $NewBody =~ s/\x0D\n/\n/g; print TEXTFILE $NewBody; close TEXTFILE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regexp for scalar containing a mixture of LF & CRLF
by diotalevi (Canon) on Dec 09, 2004 at 23:12 UTC | |
by NateTut (Deacon) on Dec 10, 2004 at 00:41 UTC | |
by diotalevi (Canon) on Dec 10, 2004 at 05:42 UTC | |
by NateTut (Deacon) on Dec 13, 2004 at 17:41 UTC | |
|
Re: regexp for scalar containing a mixture of LF & CRLF
by Eimi Metamorphoumai (Deacon) on Dec 09, 2004 at 23:05 UTC | |
by NateTut (Deacon) on Dec 09, 2004 at 23:59 UTC | |
|
Re: regexp for scalar containing a mixture of LF & CRLF
by Paladin (Vicar) on Dec 09, 2004 at 23:03 UTC | |
by NateTut (Deacon) on Dec 09, 2004 at 23:56 UTC |