General discussion
Thread display: Collapse - |
All Comments
Start or search
Create a new discussion
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
Perl - read between lines in a file
I'm trying to find a simple way to read between lines in a file with perl.
For example a file might contain...
A
bunch of lines
B
bunch of lines
C
bunch of lines
D
And I want to read the "bunch of lines" between line B and line C.
I have the file handle and can read line by line just fine so the basic part is done. I just want to be selective on what lines I'm reading. The result goes into an array, but I only want to add lines between B and C in the array. I can do this with a couple of loops but that is messy and I'm hoping someone will have a better idea. I will know what B and C are, but not what the other lines are.
Thanks for any suggestions.