in reply to Re^2: unexpected behavior with split
in thread unexpected behavior with split

I didn't use \G as a way of avoid using $'. I could have come up with a way of using \G and not using $', but I chose this way.

I did get rid of $max+6. It makes no sense. I think it was added as a hack to make $min look like it's working better than it really does. In fact, $min is totally useless unless you force a break mid-word whern there is no space between pos $min and $max (which you don't do). Until $min's function is better defined, I just dropped it completely from my version. I suppose s/^(.{$min,$max2}\S)\s+//s would probably do what you have in mind, because of the else clause.

Replies are listed 'Best First'.
Re^4: unexpected behavior with split
by ww (Archbishop) on Aug 31, 2004 at 21:49 UTC

    Your point re $min is well taken. Thanks for the explanation. I thought I needed it to deal with cases where $max came in the middle of a word, but I see now a proper regex does a better (and more generalized) job.

    re the plus six: what I was actually trying to do was to allow what would otherwise have been a very short ( < 7 chars ) lastline to be rendered together (printer's sense) with a standard-length penultimate line. ie, allow

    ...(59 chars) blah fit.

    to render as

    | ...blah fit. | #bars mark edge of frame

    rather than as
    | ...blah. | | fit. |

    but that got lost in my match_count mess.

    <G>and your first line offers more food for thought, but what I need now is actual chow...

    Afterthought: Should or can this node be renamed? Your answers make it clear that my (title) ref to split's behavior wasn't really the issue (and I would hate to have folk looking for info on split spending time OFF-topic).
    cheers.