There's another problem with your refactored code:
is not the same aswhile (<DATA>) { ... }
while (my $line = <DATA>) { ... }
The first while will stop as soon as <DATA> returns undef, so at the end of the data. The second while however, will stop as soon as it finds an empty line. The correct refactoring should have been:
while (defined (my $line = <DATA>)) { ... }
--
Lyon
In reply to Re: A refactoring trap
by redlemon
in thread A refactoring trap
by gmax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |