why does ... work correctly, even for a filename like "0" that evaluates to false in boolean context?Because it really looks like this under the hood
This is a DWIM perlism, nifty huh? I think it applies to any assignment in a while statement where the result of the assignment is evaluated for the condition, or something along those lines.opendir(D, "test"); while ( defined( $file = readdir(D) ) ) ...
_________
broquaint
In reply to Re: readdir and while - magic?
by broquaint
in thread readdir and while - magic?
by bjelli
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |