develooper Front page | perl.beginners | Postings from March 2002

Re: help me with a better backstepper?

Thread Previous
From:
John W. Krahn
Date:
March 6, 2002 10:51
Subject:
Re: help me with a better backstepper?
Message ID:
3C86652E.90CDD01@acm.org
M Z wrote:
> 
> Hi

Hello,

> I've written a little program to analyze lines that
> are longer than 70 characters, and if so, break at
> position 70 (if it is whitespace), if not whitespace
> (i.e. is in the middle of a word) it steps back to the
> first whitespace and breaks there.
> 
> However, I think there is probably a better way to do
> this.  Can someone either suggest an alternate route
> or improve this snippet?
> 
> ps. if you do suggest something cryptic, please detail
> for me, as I am still new!!! thanks
> 
> [snip code]

You probably want the Text::Wrap module.

perldoc Text::Wrap



John
-- 
use Perl;
program
fulfillment

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About