in reply to returning scalar context from map or grep
Now you know how to do it, you might think twice about whether you should do it?
Using map or grep to retrieve a single value is just as bad as using it in a void context I think. Your still building a (potentially large) list, only to discard all but one of the values. I do it myself on occasion, so I'm not waving a big stick, but it's worth thinking about the cost when you do it.
Actually, it may be even worse as I seem to recall that they had been 'fixed' to not bother building the return list in a void context? I could be wrong on that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: returning scalar context from map or grep
by !unlike (Beadle) on Apr 28, 2003 at 13:59 UTC |