in reply to Re^2: What's most efficient way to get list context? (honest)
in thread What's most efficient way to get list context?
As I understand it, the standard "list in scalar context" behavior is "size of the list".You should note that your winner does not exhibit that behavior.
would return a count (or the whole list, depending on context), but I suspect assigning to the empty list is more efficient. It's certainly a tad shorter to type.grep 1, @list;
Update: Had grep 0, due to scrambled thinking that it would still return a count of all elements, yet not build a list. Gah. Thanks, Pustular.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: What's most efficient way to get list context? (honest)
by tlm (Prior) on Apr 15, 2005 at 14:47 UTC | |
by Roy Johnson (Monsignor) on Apr 15, 2005 at 14:56 UTC |