I'm not sure how your solution is to work with what I need to do though. (Probably because of my lack of understanding with regards to substr).

The way the code reads now is:
$description =~ s/^(\s+)?$//sg; $description =~ s/\n/ /sg; while ($description) { $f_desc .= "T".(substr($description,0,75) = "")."\n"; } print $f_desc;
However, when given a description like the following (which is what I am working with) it doesn't come out quite right.
2001/08/28 10:15:54 AM auser 08/28/01 10:15:53 auser PostalCode.24th floor. MachineID, printer keeps jamming (A person' +s Name). Lexmark optra s1250. 2001/08/28 10:17:57 AM auser PostalCode.24th floor. MachineID, printer keeps jamming (A person's N +ame). Lexmark optra s1250.
The above code makes it read like:
T floor. MachineID, printer keeps jamming (A person's Name). Lexmark +optra s125 T0. 2001/08/28 10:17:57 AM auser PostalCode.24th floor. MachineID, +printer kee Tps jamming (A person's Name). Lexmark optra s1250. T
So it looks like I'm missing the first line, and I'm not sure why :-)
UPDATE: Japhy got it. That's why he's the saint and I'm the lowly whatever I am now :-)

In reply to Re: Re: substr to split lines? by the_slycer
in thread substr to split lines? by the_slycer

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.