"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.
In reply to Re^2: Print in TXT (while loop)
by ikegami
in thread Print in TXT (while loop)
by marto9
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |