I tried your code with the following setup:
INST_FILE /usr/local/lib/perl5/5.8.0/Text/Wrap.pm INST_VERSION 2001.0929
and with the following sample data file:
Here is a sample file that contains longish lines of text to be wrapped. It also contains really long words, for example: superantidisestablishmentarianismabilityness, which weighs in at 45 characters (I think), counting the comma.
and that yielded the following:
Here is a sample file that contains longish lines of text to be wrapped. It also contains really long words, for example: superantidisestablishmentarianismabilit yness, which weighs in at 45 characters (I think), counting the comma.
(Note that the last six characters of the long word were wrapped to the next line -- not five -- because Text::Wrap's notion of "column width" includes the line termination as part of the maximum allowed length.)

So, I'm not seeing the problem you mention (the big word didn't just disappear -- it's still there, and is split into pieces according to the allowed max width). Maybe there's some other step in trip to your palm pilot where something is getting lost?

Personally, I find the "picket-fence" effect demonstrated with my test file to be really annoying -- it works better if you do chomp @text; before passing the array to "wrap()".

update: BTW, I assume your real code does print FH wrap(...); -- not just "print wrap(...)".


In reply to Re: Text::Wrap and Long words by graff
in thread Text::Wrap and Long words by gohaku

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.