in reply to Re: Process large text data in array
in thread Process large text data in array
My major concern now is what will happen when user interrupted the process in the while..loop when file still open?
The same thing as would happen if he interrupted the program while you were filling the array in your OP code.
That is: the file will be closed and the program will exit without producing any output. As you are only reading the file, no data will be harmed.
Of more concern is what happens if you are producing output from within the while loop. Then, if the user interupts, the output file can contain only partial data.
To address the latter concern -- and prevent any worries about the former -- install an interrupt handler near the top of your program (or in a BEGIN block):
$SIG{ INT } = sub{}; ... while( ... ) { ... }
That will prevent the user interrupting with ^C. You can do a similar thing for most</> other signals that the user might use to interrupt.
Serach for "%SIG" in perlvar.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Process large text data in array
by hankcoder (Scribe) on Mar 11, 2015 at 17:23 UTC | |
by BrowserUk (Patriarch) on Mar 11, 2015 at 17:28 UTC | |
by hankcoder (Scribe) on Mar 11, 2015 at 17:44 UTC |