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

Re: help me with a better backstepper?

Thread Previous
John W. Krahn
March 6, 2002 10:51
Re: help me with a better backstepper?
Message ID:
M Z wrote:
> Hi


> 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

use Perl;

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About