Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Reading "slices" out of a file at known start markers

by CountZero (Bishop)
on Oct 03, 2008 at 07:24 UTC ( #715154=note: print w/replies, xml ) Need Help??


in reply to Re^2: Reading "slices" out of a file at known start markers
in thread Reading "slices" out of a file at known start markers

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

  • Comment on Re^3: Reading "slices" out of a file at known start markers

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://715154]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2021-02-27 17:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?