I used a flag variable to tell me whether I'm inside the correct section. Also, using `(...)` in a regex creates a capture group, you can add 1 to it as to any other variable. Note that you need to backslash the parentheses to give them their literal meaning.
#!/usr/bin/perl
use warnings;
use strict;
my $printing;
my $next_section = q();
while (<DATA>) {
if (/^\(([0-9]+)\) .*Significant Accounting Policies/) {
$printing = 1;
$next_section = 1 + $1;
} elsif (/^\($next_section\)\s/) {
undef $printing;
}
print if $printing;
}
__DATA__
(1) Preface
What is this all about.
(2) Summary of Significant Accounting Policies
Revenue Recognition
Revenue is recognized at the time goods are sold and shipped.
(3) Long-term Debt
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord
}map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,