in reply to Re: To Kill a Meme: while(defined($line = <>))
in thread To Kill a Meme: while(defined($line = <>))
Now, I'd be really interested in hearing what you think is the common case, and where people get it wrong by using defined ($line = <>).The most common case is reading a text file which ends with a newline. And doing so without changing $/.
What people get wrong is that they tend to think they need to check defined() because of blank lines. In other words, they get the mistaken impression that a scalar can contain a newline and be false.
-sauoq "My two cents aren't worth a dime.";
- Comment on Re: Re: To Kill a Meme: while(defined($line = <>))
- Select or Download Code
| Replies are listed 'Best First'. | |
|---|---|
|
Re: To Kill a Meme: while(defined($line = <>))
by Abigail-II (Bishop) on Nov 03, 2003 at 11:51 UTC |