in reply to Re: keys(%hash) not in scalar context in printf
in thread keys(%hash) not in scalar context in printf
With respect to the above code, it should be known that this will be interpreted in the exact same fashion as the scalar call, possibly with added instructions.
The use as an rvalue in a mathematical expression to the right of a scalar (0) forces the interpretation of the list in scalar context, as the lexer parses from left to right.
While you're saving a keystroke or two, you are making absolutely no gains in terms of performance, and potentially losing some if your platform is actually foolish enough to perform the addition to zero.
Furthermore, as a powerful perl monk, one must remember to *occasionally* pay heed to the twin divinities of readability and maintainability, lest they smite thee and thy code with hours of frustrating bug-hunts.
The "scalar" solution is by far the most straight-forward and accepted way to handle this.
Obidan
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: keys(%hash) not in scalar context in printf (clarity)
by tye (Sage) on Apr 18, 2007 at 18:29 UTC |