What's wrong with using grep or map in a void context? Both grep and map build a return list, regardless of their context. This means you're making Perl go to the trouble of building up a return list that you then just ignore. That's no way to treat a programming language, you insensitive scoundrel!
Now I guess my question is: "Why is perl bothering to accumulate results when it knows it's being called in a void context?" For example, I've written backticks/system replacements that add additional features I like (e.g. like logging). I've had them check the context (with wantarray), and not even accumulate output if called within a void context. Why can't Perl do the same thing, and leave me with a clear conscience about being lazier than I am now?
bluto
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Insensitive Scoundrel
by thraxil (Prior) on Sep 26, 2002 at 17:01 UTC | |
|
Re: Insensitive Scoundrel
by tadman (Prior) on Sep 26, 2002 at 18:10 UTC | |
by John M. Dlugosz (Monsignor) on Sep 26, 2002 at 22:10 UTC | |
by tadman (Prior) on Sep 27, 2002 at 01:07 UTC | |
by John M. Dlugosz (Monsignor) on Sep 27, 2002 at 14:42 UTC | |
by John M. Dlugosz (Monsignor) on Oct 03, 2002 at 19:03 UTC | |
by Aristotle (Chancellor) on Oct 04, 2002 at 20:22 UTC | |
by chromatic (Archbishop) on Sep 26, 2002 at 23:44 UTC | |
by jordanh (Chaplain) on Sep 28, 2002 at 16:53 UTC | |
by diotalevi (Canon) on Sep 28, 2002 at 17:35 UTC | |
|
Re: Insensitive Scoundrel
by hding (Chaplain) on Sep 27, 2002 at 13:37 UTC |