I may be blunt in this regard, but if there is a meme that should be killed in any non-oneliner programs, it's the absence of using defined() while reading from a file handle. It just adds too much extra processing when trying to read source code, especially when you have experience in other programming languages. This property of while is different from other conditional constructs, and it's even different from itself when not readng from a file handle (as you yourself point out).
This is completely seperate from any warnings that Perl may have had in the past. This is about maintainability of Perl source code.
As Juerd and others already pointed out: there is no harm in using defined() in these cases. And the extra characters typed easily offset any time lost when someone tries to read the source code later.
To me, the request to please stop using defined() when reading from a file handle, is almost the same as a request to please stop documenting your programs. It's penny wise, but pound foolish.
Liz
In reply to Re: To Kill a Meme: while(defined($line = <>))
by liz
in thread To Kill a Meme: while(defined($line = <>))
by sauoq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |