in reply to $_ and filehandles
This is not at all intuitive, but this magical short form of while() saves a lot of typing for a kind of loop which is implemented very often. If you type ANY other kind of while() loop condition, then there is no special magic anymore, and it will just use what you typed. The code <FILE> by itself doesn't assign to $_ or anything else; it's only in the magical while() that you get the assignment for free.while (<FILE>) { ... } while (defined ($_ = <FILE>)) { ... }
--
[ e d @ h a l l e y . c c ]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |