RE: help with my parser program?

2002-03-11 Thread Jason Larson
-Original Message- From: M z [mailto:[EMAIL PROTECTED]] Subject: help with my parser program? could someone please help me make this bit of code more efficient? I am trying to break really long lines, say up to 600 characters into manageable sizes (78 or less characters) but I

Re: help with my parser program?

2002-03-09 Thread Boris Zentner
Hi, i suggest to use Text::Wrap. Also you can type this maybe it is what you want. perl -ne 'print $1\n while (/\s*((?:.{1,78})|\S+)\b/g)' your_text.txt Am Samstag, 9. März 2002 19:42 hast Du geschrieben: could someone please help me make this bit of code more efficient? I am trying to

breaking a string into chunks (was Re: help with my parser program?)

2002-03-09 Thread Jeff 'japhy' Pinyan
On Mar 9, M z said: could someone please help me make this bit of code more efficient? I am trying to break really long lines, say up to 600 characters into manageable sizes (78 or less characters) but I do not want to break cleanly at position 78. If that is in the middle of a word, my

Re: breaking a string into chunks (was Re: help with my parser program?)

2002-03-09 Thread Tagore Smith
Jeff 'japhy' Pinyan wrote: $string =~ s/(.{1,78})\s/$1\n/g; I played around with this a bit and came up with something similar: $line=~ s/(.{1,78})(\Z|\s)/$1\n/g; I think $string =~ s/(.{1,78})\s/$1\n/g; assumes that the string ends in whitespace. Tagore Smith -- To