in reply to What would you do?

I get the same result with:
# set even numbered elements of the list to hi<br> map { $list [$_ * 2] = 'hi'; } (0..$#list/2);<br><br>
I am wondering if there is any difference in efficiency for Perl?
I did find two $_'s is one line of code very edifying.

Edit 2001-03-16 by tye

Replies are listed 'Best First'.
Re: Re: What would you do?
by MeowChow (Vicar) on Mar 17, 2001 at 02:38 UTC
    This is effectively the same thing as bjelli's solution above, with a map instead of a for, and no temporary variable. It is somewhat less efficient due to the use of map in a void context, which is usually considered bad programming practice.