in reply to adding newline to middle of a string cleanly

Me again. Does this do what you want?
$t =~ s/(.{39}[^\s]*)\s+/$1\n/; $t =~ s/([^\n]{60}[^\s]*)\s+/$1\n/g;
Update: removed unnecessary parens. I don't know what I was thinking when I put them in.

The PerlMonk tr/// Advocate

Replies are listed 'Best First'.
Re: Re: adding newline to middle of a string cleanly
by tbone (Beadle) on Dec 10, 2003 at 14:44 UTC
    Thanks Roy...exactly what I was looking for.