in reply to Uninitialized string warning
What the others failed explain is that <> only assigns it's value to $_ when it is the entirety of the while's condition. When you added the and bit, it ceased to be special. In other words,
while (<>) {
is equivalent to
while (defined($_ = <>)) {
but
while (<> and ...) {
is equivalent to
while (<> and ...) {
Notice the lack of $_ = in the second case.
That's why
while (defined($_ = <>) and $_ ne ".\n") {
is needed.
Update: It seems that Sandy explained the same thing while I was writting my reply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Uninitialized string warning
by Anonymous Monk on May 11, 2005 at 21:55 UTC | |
by ikegami (Patriarch) on May 11, 2005 at 22:06 UTC |