perl -w warns me that is is safer to write constructions of the form while($line=<HANDLE>){ as while(defined($line=<HANDLE>)){ and I surely agree. "defined" is implemented as a function call in these cases, and profiling indicates that a performance hit is taken, contrary to the performance improvement I had hoped for, since not as much is needed to be checked: when evaluating definedness, we only are concerned with one of the several aspects of "truth" as it is normally defined, and we need not bother to check the rest of them. I wonder how complex it would be to make "defined," when it is used as the outer function call in any execution path construction, (i.e. anywhere the warning would be triggered), not be a function call but instead modify what truth means for the purposes of the truth-interpreting construct. Right now truth is set as a language-wide constant. What if "defined" stopped being a function but instead became a pragma restricting "truth" in the context in which it appears? It seems this could be implemented in a variety of ways :) One would be to have a variable "truth mask" which would have bits within it on or off depending on what truth means at the moment, which would need to be referred to constantly. Another would be to have an alternate form of boolean evaluator primitive which expressions of the form (defined(A)?B:C) would use instead, by a mechanism surely about as complex as the one that currently warns about dangerous constructions. This collapse could take place in any and all circumstances where the "defined" function is called in a boolean context. Determining a "boolean" as opposed to "scalar" context I guess would be the real extension to perl internals, wouldn't it. ___________________________________________________________________ David Nicol 816.235.1187 nicold@umkc.edu armchair perl internals hacker ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe