in reply to do-until inside while loop control
G'day mtorba,
Welcome to the Monastery.
This sounds like a job for the Range Operator. Perhaps something like this:
#!/usr/bin/env perl use strict; use warnings; while (<DATA>) { if (/^regex1/ .. /^regex3/) { last if /^regex3/; print; } } __DATA__ PRE REGEX LINES regex1 - grab general informations about regex1 grab more informations on this line about regex1 regex2 - grab general informations about regex2 grab more informations on this line about regex2 regex3 - grab general informations about regex3 grab more informations on this line about regex3 POST REGEX LINES
Output:
regex1 - grab general informations about regex1 grab more informations on this line about regex1 regex2 - grab general informations about regex2 grab more informations on this line about regex2
While I appreciate this is your first post, it is lacking in several areas (including runnable code, actual output, expected output, etc.) and responses will reflect this. A better question will get you a better answer. Please see "How do I post a question effectively?" for ways to improve future posts.
— Ken
|
|---|