On 10/9/09 Fri Oct 9, 2009 7:43 AM, "Harry Putnam" <rea...@newsguy.com> scribbled:
> I'm thinking of splitting on something like ' +' (<spc><spc>+) since > no regular output will have 2 spc or more between connected > words.... I mean words that belong in a group. I would use the construct /\s{2,}/ for "two or more spaces", as it is less likely to be misread. > > A quick test with: > > while(<>){ > my @linar = split(/ +/,$_); > print "<" . @linar . ">\n"; > } > > Shows all lines split into 4 elements... which is what I want... then > I can test for a long element and fold it... maybe on commas since the > options are separated by commas. > > Do you have any idea if that would cause significant cpu usage. I > mean testing every field for length. There would be 4 per line and > some 100+ lines. So, 400+ tests. That is a trivial number. Anytime you are reading from a file, the I/O time will dominate your performance. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/