<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Text::Wrap</title>
	<atom:link href="http://www.bayview.com/blog/2002/08/02/textwrap/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bayview.com/blog/2002/08/02/textwrap/</link>
	<description>Bay View Consulting Services, Inc.</description>
	<pubDate>Thu, 20 Nov 2008 15:40:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Mike</title>
		<link>http://www.bayview.com/blog/2002/08/02/textwrap/#comment-17912</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Mon, 01 Oct 2007 20:05:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=16#comment-17912</guid>
		<description>I have the following code that does not work against a large text file (notepad)
&lt;code&gt;
#! / usr/bin/perl -w
use Text::Wrap qw(wrap $columns $huge);
$columns = 132;
$huge = "die";
#
#
$name = $ARGV[0];
$name1 = $ARGV[1];
#
#
open (INFILE, "$name1");
while (my $row = ) {
    print OUTFILE wrap('','',$row) ;
}
close (INFILE);
close (OUTFILE);

&lt;/code&gt;

The input file is 4MB and contains variable lenght lines of what would seem to be meaningless text. It is actually an EDI file where each record is seperated by a "~" tilde.  I need the file reformated to remove any prexisting carriage returns, and the print the output file as lines of 80 characters maximm.

Can some one help me make adjustments to my code, and understand what is going wrong?  This code simply prints each line that breaks at the "~"

Thanks</description>
		<content:encoded><![CDATA[<p>I have the following code that does not work against a large text file (notepad)<br />
<code><br />
#! / usr/bin/perl -w<br />
use Text::Wrap qw(wrap $columns $huge);<br />
$columns = 132;<br />
$huge = "die";<br />
#<br />
#<br />
$name = $ARGV[0];<br />
$name1 = $ARGV[1];<br />
#<br />
#<br />
open (INFILE, &#8220;$name1&#8243;);<br />
while (my $row = ) {<br />
    print OUTFILE wrap(&#8221;,&#8221;,$row) ;<br />
}<br />
close (INFILE);<br />
close (OUTFILE);</p>
<p></code></p>
<p>The input file is 4MB and contains variable lenght lines of what would seem to be meaningless text. It is actually an EDI file where each record is seperated by a &#8220;~&#8221; tilde.  I need the file reformated to remove any prexisting carriage returns, and the print the output file as lines of 80 characters maximm.</p>
<p>Can some one help me make adjustments to my code, and understand what is going wrong?  This code simply prints each line that breaks at the &#8220;~&#8221;</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William Ward</title>
		<link>http://www.bayview.com/blog/2002/08/02/textwrap/#comment-17256</link>
		<dc:creator>William Ward</dc:creator>
		<pubDate>Wed, 19 Sep 2007 22:19:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=16#comment-17256</guid>
		<description>Sorry I just got back from vacation and have been very busy.  I looked at your pics but haven't had time to figure out the cause of your issue.</description>
		<content:encoded><![CDATA[<p>Sorry I just got back from vacation and have been very busy.  I looked at your pics but haven&#8217;t had time to figure out the cause of your issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yoavhayun</title>
		<link>http://www.bayview.com/blog/2002/08/02/textwrap/#comment-17236</link>
		<dc:creator>yoavhayun</dc:creator>
		<pubDate>Wed, 19 Sep 2007 13:45:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=16#comment-17236</guid>
		<description>it's been a while and you didn't answer my question... wanted to know why..
anyways... hope to hear from you.</description>
		<content:encoded><![CDATA[<p>it&#8217;s been a while and you didn&#8217;t answer my question&#8230; wanted to know why..<br />
anyways&#8230; hope to hear from you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yoav Hayun</title>
		<link>http://www.bayview.com/blog/2002/08/02/textwrap/#comment-16977</link>
		<dc:creator>Yoav Hayun</dc:creator>
		<pubDate>Fri, 14 Sep 2007 22:05:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=16#comment-16977</guid>
		<description>ok I guess it was to long. here it is:

ok I'll try to explain myself better.
I have a text in a var. lets say Text:
my $Text = qq{title
-step1...
-step2...
-step3...};

now I want to print it. so this is my line of code:

print wrap(""," ","$Text");

the problem is that not only there is a space every new line (and not only when a word is being wrapped) but also the first word of the new line is at the same column as the '-' at the beginnig of each step.

you also must know that there's is an exe file that reads the guide and a txt file that is the guide (containing all the information) so I cannot use the print function for every step.

I'm also adding pics:
what I want:
http://img209.imageshack.us/img209/8049/wanthz5.png

what I get:
http://img297.imageshack.us/img297/5079/getfg8.png

thank you for your help.</description>
		<content:encoded><![CDATA[<p>ok I guess it was to long. here it is:</p>
<p>ok I&#8217;ll try to explain myself better.<br />
I have a text in a var. lets say Text:<br />
my $Text = qq{title<br />
-step1&#8230;<br />
-step2&#8230;<br />
-step3&#8230;};</p>
<p>now I want to print it. so this is my line of code:</p>
<p>print wrap(&#8221;",&#8221; &#8220;,&#8221;$Text&#8221;);</p>
<p>the problem is that not only there is a space every new line (and not only when a word is being wrapped) but also the first word of the new line is at the same column as the &#8216;-&#8217; at the beginnig of each step.</p>
<p>you also must know that there&#8217;s is an exe file that reads the guide and a txt file that is the guide (containing all the information) so I cannot use the print function for every step.</p>
<p>I&#8217;m also adding pics:<br />
what I want:<br />
<a href="http://img209.imageshack.us/img209/8049/wanthz5.png" rel="nofollow">http://img209.imageshack.us/img209/8049/wanthz5.png</a></p>
<p>what I get:<br />
<a href="http://img297.imageshack.us/img297/5079/getfg8.png" rel="nofollow">http://img297.imageshack.us/img297/5079/getfg8.png</a></p>
<p>thank you for your help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yoav Hayun</title>
		<link>http://www.bayview.com/blog/2002/08/02/textwrap/#comment-16976</link>
		<dc:creator>Yoav Hayun</dc:creator>
		<pubDate>Fri, 14 Sep 2007 22:04:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=16#comment-16976</guid>
		<description>hummm I can't seem to be able to upload a new comment...</description>
		<content:encoded><![CDATA[<p>hummm I can&#8217;t seem to be able to upload a new comment&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William Ward</title>
		<link>http://www.bayview.com/blog/2002/08/02/textwrap/#comment-16897</link>
		<dc:creator>William Ward</dc:creator>
		<pubDate>Thu, 13 Sep 2007 19:26:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=16#comment-16897</guid>
		<description>Can you post a bigger piece of your code?  I'm not quite sure what you are asking.

Two things that might be relevant:

1. Text::Wrap expects each argument to be one line of text.  So you might have to split your string up into individual strings, with each string being one line, and then pass those to wrap.

2. The print function does not insert spaces in between the lines of output.  If you put an array inside single quotes, it does.  So if that's what you want, put the text into an array and print "@array" instead.  Or use join().</description>
		<content:encoded><![CDATA[<p>Can you post a bigger piece of your code?  I&#8217;m not quite sure what you are asking.</p>
<p>Two things that might be relevant:</p>
<p>1. Text::Wrap expects each argument to be one line of text.  So you might have to split your string up into individual strings, with each string being one line, and then pass those to wrap.</p>
<p>2. The print function does not insert spaces in between the lines of output.  If you put an array inside single quotes, it does.  So if that&#8217;s what you want, put the text into an array and print &#8220;@array&#8221; instead.  Or use join().</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yoav Hayun</title>
		<link>http://www.bayview.com/blog/2002/08/02/textwrap/#comment-16873</link>
		<dc:creator>Yoav Hayun</dc:creator>
		<pubDate>Thu, 13 Sep 2007 14:25:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=16#comment-16873</guid>
		<description>oh... it doesn't put in spaces.

(S) = space

What is want:
“title.
-step1...
(S)...
-step2...
(S)...
-step3...
(S)..."

what I get:

“title. (S)
(S)-step1...
(S)...
(S)-step2...
(S)...
(S)-step3...
(S)..."</description>
		<content:encoded><![CDATA[<p>oh&#8230; it doesn&#8217;t put in spaces.</p>
<p>(S) = space</p>
<p>What is want:<br />
“title.<br />
-step1&#8230;<br />
(S)&#8230;<br />
-step2&#8230;<br />
(S)&#8230;<br />
-step3&#8230;<br />
(S)&#8230;&#8221;</p>
<p>what I get:</p>
<p>“title. (S)<br />
(S)-step1&#8230;<br />
(S)&#8230;<br />
(S)-step2&#8230;<br />
(S)&#8230;<br />
(S)-step3&#8230;<br />
(S)&#8230;&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yoav Hayun</title>
		<link>http://www.bayview.com/blog/2002/08/02/textwrap/#comment-16872</link>
		<dc:creator>Yoav Hayun</dc:creator>
		<pubDate>Thu, 13 Sep 2007 14:22:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=16#comment-16872</guid>
		<description>well I have a question about word wraping.
I've created an easy to use text guide with perl.
I've devided it into a program that reads the guide and a program that is the guide.
when I print the part the user is asking for I want it to print it like so:

"title.
-step1......
 .......
-step2......
 .....
-step3....
 .....
"

I've used this line of code to do so:
print wrap(""," ","$text");

the problem is that is comes out like this:

"title.
 -step1...
 ...
 -step2...
 ...
 -step3...
 ..."

my problem is that it puts a space every time there is a new line instead of only doing so when wraping a word.

I really hope you understood my problem and that you have a sulotion for me.

thank you for your time =]</description>
		<content:encoded><![CDATA[<p>well I have a question about word wraping.<br />
I&#8217;ve created an easy to use text guide with perl.<br />
I&#8217;ve devided it into a program that reads the guide and a program that is the guide.<br />
when I print the part the user is asking for I want it to print it like so:</p>
<p>&#8220;title.<br />
-step1&#8230;&#8230;<br />
 &#8230;&#8230;.<br />
-step2&#8230;&#8230;<br />
 &#8230;..<br />
-step3&#8230;.<br />
 &#8230;..<br />
&#8221;</p>
<p>I&#8217;ve used this line of code to do so:<br />
print wrap(&#8221;",&#8221; &#8220;,&#8221;$text&#8221;);</p>
<p>the problem is that is comes out like this:</p>
<p>&#8220;title.<br />
 -step1&#8230;<br />
 &#8230;<br />
 -step2&#8230;<br />
 &#8230;<br />
 -step3&#8230;<br />
 &#8230;&#8221;</p>
<p>my problem is that it puts a space every time there is a new line instead of only doing so when wraping a word.</p>
<p>I really hope you understood my problem and that you have a sulotion for me.</p>
<p>thank you for your time =]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William Ward</title>
		<link>http://www.bayview.com/blog/2002/08/02/textwrap/#comment-445</link>
		<dc:creator>William Ward</dc:creator>
		<pubDate>Fri, 30 Jun 2006 21:37:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=16#comment-445</guid>
		<description>Does your program use the Text::Wrap module?  I'm not sure what your code is trying to do.  Perhaps if you post an example of the code I might be able to say more.</description>
		<content:encoded><![CDATA[<p>Does your program use the Text::Wrap module?  I&#8217;m not sure what your code is trying to do.  Perhaps if you post an example of the code I might be able to say more.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.bayview.com/blog/2002/08/02/textwrap/#comment-440</link>
		<dc:creator>John</dc:creator>
		<pubDate>Fri, 30 Jun 2006 01:45:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.bayview.com/blog/?p=16#comment-440</guid>
		<description>i have a while loop on my file.pl perl source code.  When i enter a huge number like 1000, the perl source code while function doesn't wrap the numbers to reach zero on my browswer.  Ne code that'll make it wrap.</description>
		<content:encoded><![CDATA[<p>i have a while loop on my file.pl perl source code.  When i enter a huge number like 1000, the perl source code while function doesn&#8217;t wrap the numbers to reach zero on my browswer.  Ne code that&#8217;ll make it wrap.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
