Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
RE: Re: searching backwards in a stringby Anonymous Monk |
on Jun 13, 2000 at 16:06 UTC ( [id://17875]=note: print w/replies, xml ) | Need Help?? |
>>
while($text =~ /(.{0,80})\s+/g) {
# result in $1
}
<<
I believe that the above snippet is an infinite loop. However, if TEXT is a filehandle then while(<TEXT> =~ /(.{0,80})\s+/g){ # result in $1 } should kill all trailing space and line returns.
Isn't that what chomp is for, though?
In Section
Seekers of Perl Wisdom
|
|