line wrapping
I have entries typed in by clients that need to wrap.
If a client were to type in a string of chars (say 100) without a space,
i need a substitution that would insert a break and newline at space
80. How would one do that with a s/// type statement?
Re: line wrapping
On Jan 28, 10:34 am, monkeys paw <u... [at] example.net> wrote:
> I have entries typed in by clients that need to wrap.
> If a client were to type in a string of chars (say 100) without a space,
> i need a substitution that would insert a break and newline at space
> 80. How would one do that with a s/// type statement?
use Text::Wrap
http://search.cpan.org/~muir/Text-Tabs+Wrap-2006.1117/lib/Te xt/Wrap.pm
Re: line wrapping
In article <5vGdncn_6fOtvQPanZ2dnUVZ_rignZ2d [at] insightbb.com>, monkeys
paw <user [at] example.net> wrote:
> I have entries typed in by clients that need to wrap.
> If a client were to type in a string of chars (say 100) without a space,
> i need a substitution that would insert a break and newline at space
> 80. How would one do that with a s/// type statement?
One would use substr, rather than an RE:
substr($entry,80,0,"\n");
If one insisted on using REs:
$entry =~ s/^(.{80})/$1\n/;
Note: a "newline" is assumed to be the desired "break" here.
For larger jobs, the Text::Wrap module is recommended.
--
Jim Gibson
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com