in reply to truth in while condition
> If the condition expression of a while statement is based on any of a group of iterative expression types then it gets some magic treatment. The affected iterative expression types are readline, the<FILEHANDLE> input operator,readdir, glob, the <PATTERN>globbing operator, and each. If the condition expression is one of these expression types, then the value yielded by the iterative operator will be implicitly assigned to $_. If the condition expression is one of these expression types or an explicit assignment of one of them to a scalar, then the condition actually tests for definedness of the expression's value, not for its regular truth value.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: truth in while condition
by haukex (Archbishop) on Sep 30, 2018 at 17:05 UTC | |
by LanX (Saint) on Sep 30, 2018 at 17:55 UTC | |
|
Re^2: truth in while condition
by ikegami (Patriarch) on Oct 02, 2018 at 02:55 UTC | |
by LanX (Saint) on Oct 02, 2018 at 12:32 UTC | |
|
Re^2: truth in while condition
by TISON (Acolyte) on Sep 30, 2018 at 11:31 UTC |