in reply to Re: Print in TXT (while loop)
in thread Print in TXT (while loop)
"I have a buffering problem, so I'll use 'for' instead of 'while'." I don't see the relation or the logic in that.
If it's an independent question, then not only is it not easier (while (<$list_fh>) vs for (<$list_fh>) are equally easy to type), the for version needlessly uses more memory. for (<$list_fh>) causes the entire file to be read into memory before the loop starts whereas while (<$list_fh>) (short for while (defined($_ = <$list_fh>))) reads one line at a time.
|
---|