While not tested, I saw this elegant solution in this
print if /\[foo\]/ .. /\[foo2\]/ foreach ( @lines );
Credits go to zigdon
Update: Check Ovid's answer; it's more strict in the requirements set.
"A chicken is an egg's way of producing more eggs."