Using a variable is even required if you want to add error checking.
while (my $line = <DATA>) { if ( $. % 10 == 1 ) { print $line; } for (0 .. 3) { defined( my $important_line = <DATA> ) or die("Premature EOF\n"); print $important_line; } }
In reply to Re^4: Hmmm: while(), file handle and $_ gotcha
by ikegami
in thread Hmmm: while(), file handle and $_ gotcha
by roboticus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |