> -----Original Message----- > From: M z [mailto:[EMAIL PROTECTED]] > Subject: help with my parser program? > > could someone please help me make this bit of code > more efficient? I am trying to break really long > lines, say up to 600 characters into manageable sizes > (78 or less characters) but I do not want to break > cleanly at position 78. If that is in the middle of a > word, my program back steps to the first whitepace. > > but I think I am overdoing it here, although it seems > to give me the results I want. > > I would not like to use a module for this, but rather > have it hard coded myself. Please help me without > module advice if possible
<RANT_> It's ridiculous that this is being re-posted, but this is Japhy's response to YOUR question from a few days ago... s/(.{1,78})\s/$1\n/g; <RANT_> open(X, "<w") || die "can't open test file ($!)\n"; while(<X>) { s/(.{1,78})\s/$1\n/g; print; } <RANT_> The really bad part about this is is that *I* posted this response (from the original message) to another user just a couple of days after the original message, so this answer is out there twice already. <RANT_> Hope this helps... Jason CONFIDENTIALITY NOTICE: ************************************************************************ The information contained in this ELECTRONIC MAIL transmission is confidential. It may also be privileged work product or proprietary information. This information is intended for the exclusive use of the addressee(s). If you are not the intended recipient, you are hereby notified that any use, disclosure, dissemination, distribution [other than to the addressee(s)], copying or taking of any action because of this information is strictly prohibited. ************************************************************************