![]() |
|
Welcome to the Monastery | |
PerlMonks |
Re: Re: Removing Duplicate Array Elements!!!by tachyon (Chancellor) |
on Sep 27, 2001 at 17:33 UTC ( #115087=note: print w/replies, xml ) | Need Help?? |
While using map certainly works, using map in a void context like you do is inefficient. Map returns an array for you regardless of whether you use it or not. As a result using map as a surrogate for loop is bad practice. In golf you use it because it is 2 chars shorter than a for loop. That is about the only (valid) reason to use it in a void context :-) All you actually want is:
This is far more efficient, it is also shorter for what it's worth. Thanks to chipmunk for straigtening me out on this some months ago.
cheers tachyon s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In Section
Seekers of Perl Wisdom
|
|