Hi Branden, > > # Get a count of the number of lines before the first blank line, which > > # we'll pass to .Vb as its parameter. This tells *roff to keep that > > many > > # lines together. We don't want to tell *roff to keep huge blocks > > # together. > > my @lines = split (m{ \n }xms, $text); > > my $unbroken = 0; > > for my $line (@lines) { > > last if $line =~ m{ \A \s* \z }xms; > > $unbroken++; > > } > > if ($unbroken > 12) { > > $unbroken = 10; > > } ... > Well, you can throw away that line counting logic in Perl altogether > and simply use `ne` _before_ EX (not EE).
I think the code is counting the number of lines in the first ‘paragraph’ although I find it misleading given it uses \A and \z with //ms on a string which will only contain one line. If that's its aim then it would be simpler to just count the number of leading non-blank lines. $ for s in '' $'\n' $'a\n' $'a\na\n' $'a\n\n' $'a\n\na\n'; do > perl -n0777e '$n = () = /\G^.*\S.*\n/mg; print "$n\n"' <<<"$s" > done 0 0 1 2 1 1 $ -- Cheers, Ralph.