Return data from subroutine while the subroutine is still processing

Posted by Perl QuestionAsker on Stack Overflow See other posts from Stack Overflow or by Perl QuestionAsker
Published on 2010-04-29T20:00:22Z Indexed on 2010/04/29 20:07 UTC
Read the original article Hit count: 400

Filed under:
|
|
|
|

Is there any way to have a subroutine send data back while still processing? For instance (this example used simply to illustrate) - a subroutine reads a file. While it is reading through the file, if some condition is met, then "return" that line and keep processing. I know there are those that will answer - why would you want to do that? and why don't you just ...?, but I really would like to know if this is possible. Thank you so much in advance.

© Stack Overflow or respective owner

Related posts about perl

Related posts about subroutine