Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: problem with 'bare LF' in script

by blazar (Canon)
on Nov 12, 2008 at 13:31 UTC ( #723143=note: print w/ replies, xml ) Need Help??


in reply to Re^2: problem with 'bare LF' in script
in thread problem with 'bare LF' in script

$__to =~ s/(\r\n|\n\r|\r|\n)/\r\n/sg; $__cc =~ s/(\r\n|\n\r|\r|\n)/\r\n/sg; $__bcc =~ s/(\r\n|\n\r|\r|\n)/\r\n/sg; $__from =~ s/(\r\n|\n\r|\r|\n)/\r\n/sg; $__subject =~ s/(\r\n|\n\r|\r|\n)/\r\n/sg; $__html_message =~ s/(\r\n|\n\r|\r|\n)/\r\n/sg; $__text_message =~ s/(\r\n|\n\r|\r|\n)/\r\n/sg; $__importance =~ s/(\r\n|\n\r|\r|\n)/\r\n/sg; $__xpriority =~ s/(\r\n|\n\r|\r|\n)/\r\n/sg; $__x_ms_priority =~ s/(\r\n|\n\r|\r|\n)/\r\n/sg; $_mail_Message =~ s/(\r\n|\n\r|\r|\n)/\r\n/sg;

I personally believe that if those substitutions are in fact all the same substitution, which seems to be the case -and would be most reasonable/probable- although I'm not sure due the alignment... then I should point out, on a totally OT basis wrt your actual problem, that you'd probably better do:

s{ \n\r | \r | \n }{\r\n}gx for $__to, $__cc, $__bcc, $__from, $__subject, $__html_message, $__text_message, $__importance, $__xpriority, $__x_ms_priority, $_mail_Message;

I also edited the regex to the point of:

  • removing a set of unnecessary capturing parens;
  • removing a pattern that would be replaced by itself;
  • improving readability with /x (incidentally, /s did nothing there...) and alternate delimiters.
--
If you can't understand the incipit, then please check the IPB Campaign.


Comment on Re^3: problem with 'bare LF' in script
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://723143]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (15)
As of 2015-07-02 19:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (44 votes), past polls