Hi, you are welcome;
I used a buffer to be able to switch the lines positions, since you required that a line jumped "up". Like if you receive a bunch of emails, but you need to forward them to someone else in a different sequence: You cannot forward each one upon receiving, but let them sit in your mailbox until you have a complete set to reorder and forward in any desired sequence - hence the buffering. If you only had required that a line was suppressed, no buffering would be required; I'd just count the lines on each block and print/not print out the lines as soon as they were read. Whenever you need to change the order of an input before outputting (for example, doing a "sort") you'll need to hold the information for a while, so a buffer is required.
I don't think this would be in the perl docs; the decision of using a buffer was easy, because I don't know how to do it without it
- Now, if what you meant to ask was about how do I got to know that perl had the specific capabilities I used (push, array manipulation, etc), then yes, somewhere in the past I got that from reading the perl documentation (which is very good; man perlintro if you want a starting point) and the O'Reilly "Camel" book (and lots of experimenting/trial&error/fun).
Perl was born for this kind of stuff as a "Practical Extraction and Report Language", IMHO, it's the best suited tool for this specific type of task, although of course any language can achieve the same results.
Joao S Veiga