in reply to Re^7: 80 characters long
in thread 80 characters long
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: 80 characters long
by ww (Archbishop) on Sep 29, 2007 at 10:46 UTC | |
Then, your comment, 012: # strip out all Carriage Returnsmatches neither what you say you want to do, nor what you are doing. There's no mechanism in your code to remove "carriage returns" ... and you can't very well replace each tilde with a "carriage return" and retain the tildes. What's more, the output I see appears to retain the tildes. So perhaps you should clarify your question (preferably, after clearing up your understanding of what text-wrapping IS and what Text::Wrap DOES (for which, perldoc Text::Wrap should help.) | [reply] |
|
Re^9: 80 characters long
by furry_marmot (Pilgrim) on Sep 29, 2007 at 20:33 UTC | |
I have been trying to figure out what you're doing and saying, and I am also stumped. Either you're not very good at telling us what you want, or you don't really know. Sorry if it's harsh, but I've been over this several times (slow day) and you're inconsistent at best. In your code snippet, you say: Okay, but the text before this code that says the tilde must remain and in Notepad there is a CR after each tilde. If you replace the tilde, it is by definition no longer there. So, since your description is contradictory and doesn't match the format you say you want, let's take a look at the sample text you provide and try to deduce what you want. (NOTE: perlmonks may wrap the lines for display.) You say this: should look like this:
First line (ISA*...) breaks cleanly at 79 characters, in the middle of a "word". The remainder of the line retains its tilde (as do all the lines). Fine. But the second line (GS*...) breaks after 49 characters — when the whole line was only 64 characters! Why? Was it because of the asterisk?
The third line (ST*...) is unchanged, but the fourth line (BPR*...) breaks after 48 characters (total line length 109 chars). Again, in the middle of a "word". Um...why?
So, not to put too fine a point on it, do you have any idea what you are talking about? -dd | [reply] [d/l] [select] |
by aixmike (Novice) on Oct 01, 2007 at 17:00 UTC | |
The Inputfile sample ->
| [reply] [d/l] [select] |
by ikegami (Patriarch) on Oct 01, 2007 at 20:12 UTC | |
First, you mean "Line Feed" (chr(10)), not "Carriage Return" (chr(13)). Second, providing the desired output along with a sample input is very useful, especially when you have problems explaining what you want. Finally, we've coverered that Text::Wrap broke on word boundaries on the first day, before you even started using Text::Wrap. Not only did I say "Text::Wrap will only break on a word boundary.", I provided code that broke on the 80th column unconditionally. Let's go back to that code and fix it for the then-unmentioned requirements to remove existing line breaks.
Usage:
Or if you want to modify it in-place:
Output for provided input:
| [reply] [d/l] [select] |