Quoth "gnari" <>:
> "Ken Sington" <ken_sington@nospam_abcdefg.com> wrote in message
> news:KXOdnbq1X6-1aVHdRWPC-...
> > criticism is good.
> > here's my function to wrap really long lines:
> > very basic.
> >
> > # wrap long lines ###################################
> > sub wrapLine {
> > my ($line) = @_;
> > $line =~ s/.{70}/$&\n/g;
>
> the use of $& degrades performance, if that is an issue.
Note that the right answer (s/(.{70})/$1\n/g) will not increase the
speed of *that* regex, it will just prevent a speed penalty on matches
which don't use capturing brackets.
To the OP: try Text::Wrap or Text::Format, or even the faq...
Ben
--
Like all men in Babylon I have been a proconsul; like all, a slave ... During
one lunar year, I have been declared invisible; I shrieked and was not heard,
I stole my bread and was not decapitated.
~
~ Jorge Luis Borges, 'The Babylon Lottery'