>>>>> "Peter" == Peter Farrar <[EMAIL PROTECTED]> writes:

>> Replace
>> 
>> EVIL: map { some;block;of;code;that;changes;$_ } @some_array;
>> 
>> with
>> 
>> GOOD: for (@some_array) { some;block;of;code;that;changes;$_ }

Peter> I guess I don't get it.  Map returns a value and I ignore it; so what?
Peter> What side effects does this have?  Which one's faster?  I like to avoid
Peter> obvious loops when possible because I perceive them as slow, so I often use
Peter> map, and rarely (actually, to date, never) care about the return value.  If
Peter> there's no savings then I guess it doesn't matter.  But what makes it bad?

The foreach loop *will* be faster.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to