First, thanks for you efforts ... this really is puzzling.

OK - I fooled around, and found an approach that eliminates the spaces, but not the "over the limit" word.

FWIW, I'm using Perl 5.00503 (OS solaris), and don't know the Text::Wrap version (I've no root access, but could find out the version if it ends up being critical).

When I read the file into a variable (rather then an array), the spaces do not appear, but the long URL still gets moved to the end of the output.

If I use:
open (FILE,"<$script_path/$file") || die "NFG1 $script_path/$file!\n"; @CONTENT = <FILE>; close(FILE); $Text::Wrap::columns = '40'; print wrap("","",@CONTENT);
The spaces show up. If I use:
open (FILE,"<$script_path/$file") || die "NFG1 $script_path/$file!\n"; while (<FILE>){ $CONTENT .= $_; } close(FILE); $Text::Wrap::columns = '40'; print wrap("","",$CONTENT);
The spaces no longer appear, but again, the long URL is tossed in at the bottom. Here's how the output appears:

This program is distributed in the hope
... ## 7 lines ## ...
Artistic License for more details.

You should have received a copy of the
... ## 4 lines THIS PARAGRAPH CONTAINS THE LONG URL ## ...
glad to provide one.

You should also have received a copy of
... ## 8 lines ## ...
on the internet at

For those of you that choose to use the
... ## 40 lines ## ...
that.

##and tossed in at the end is the (split)long URL:

http://www.gnu.org/copyleft/hhhhhhhhhhh
hh/hhhhhhhhhhhhhhhhhh/gpl.html.

Very strange, all suggestions welcome


In reply to RE: Text::Wrap - having problems with long words by Hagbone
in thread Text::Wrap - having problems with long words by Hagbone

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.