good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I might have some use cases where this will fail, for example if SOURCES = ... happens to be the very last block in the file (i.e. there IS no next marker, other than EOF).The range operator will still work as expected since this operator returns TRUE once the first test succeeds until the second test succeeds, which by definition will never happen as there will be no next marker. Hence it will print from the first marker until EOF. For multiple blocks, it will be easiest to rewind the file and start again with new begin and end markers. Unless your MAKEFILE is huge that would not cost you a lot of time and will keep the logic of your program easy to understand and maintain. CountZero A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James In reply to Re^3: Reading "slices" out of a file at known start markers
by CountZero
|
|