note
GrandFather
<p>Something like this?</p>
<c>
use warnings;
use strict;
my $linesSinceBreak = 0;
while (<DATA>)
{
chomp;
$linesSinceBreak = 0, print "\n<<BreakHere\n" if ++$linesSinceBreak >= 15 && ! length $_;
print "$_\n";
}
</c>
<readmore title="Sample data and output">
<c>
__DATA__
I have the text of a play which I was to put into
a presentation. So I need to
split it up every 15 lines or so.
I had already stated to do this in vim by recording
a macro where I would
insert some special text say xñx (which I can then
parse upon) after I'd moved
down around 15 lines.
Can this be done in perl (more automatically I guess)?
Also does it complicate
things to not want to introduce the parsing marker
when the 15 line account
occurs in the middle of a paragraph?
Sorry for not having a good grasp of the parsing lingo
here, but hopefully
you get what I want to do.
I have the text of a play which I was to put into a
presentation. So I need to
split it up every 15 lines or so.
I had already stated to do this in vim by recording
a macro where I would
insert some special text say xñx (which I can then
parse upon) after I'd moved
down around 15 lines.
Can this be done in perl (more automatically I guess)?
Also does it complicate
things to not want to introduce the parsing marker when
the 15 line account
occurs in the middle of a paragraph?
Sorry for not having a good grasp of the parsing
lingo here, but hopefully
you get what I want to do.
</c>
<p>Prints:</p>
<c>
I have the text of a play which I was to put into
a presentation. So I need to
split it up every 15 lines or so.
I had already stated to do this in vim by recording
a macro where I would
insert some special text say xñx (which I can then
parse upon) after I'd moved
down around 15 lines.
Can this be done in perl (more automatically I guess)?
Also does it complicate
things to not want to introduce the parsing marker
when the 15 line account
occurs in the middle of a paragraph?
<<BreakHere
Sorry for not having a good grasp of the parsing lingo
here, but hopefully
you get what I want to do.
I have the text of a play which I was to put into a
presentation. So I need to
split it up every 15 lines or so.
I had already stated to do this in vim by recording
a macro where I would
insert some special text say xñx (which I can then
parse upon) after I'd moved
down around 15 lines.
Can this be done in perl (more automatically I guess)?
Also does it complicate
things to not want to introduce the parsing marker when
the 15 line account
occurs in the middle of a paragraph?
<<BreakHere
Sorry for not having a good grasp of the parsing
lingo here, but hopefully
you get what I want to do.
</c>
</readmore>
<div class="pmsig"><div class="pmsig-461912">
<hr>Perl is Huffman encoded by design.
</div></div>
504072
504072