in reply to I want to write a function, you call it ,it will return one matched record each time!
Two observations:
You always read in the whole file. You need to stop once you found what you were looking for. E.g. replace $in_block = 0; with last;
You need to store the new position returned from your function call and pass it back on the next call to the function. Currently, you only keep the record.
|
|---|