I need to read in multi-line records and trim them down to exactly 40 lines. Then
pad them to be 45 lines. They might be as large as 70 + lines. These records need
to end up being 45 lines.
The record separator is a line beginning with the pattern /^#matchee/.
I’m assuming you’d set $/ to #matchee.
{
$/ = "#matchee";
while (<>) {
# I need to print first 40
# lines of each record then
# pad to 45 with delimiter as
# last line.
}
}
Sample record
REDUNDANCY DEPARTMENT
Anonymous Ave
Item 1
Item 2
<bunch of blank lines>
#matchee
Here’s my solution…
+1 for using
$/ = "#matchee";This isn’t quite right… the first record has 45 lines, the second has 44.