Or...$_ = 'hi' for @list[map {$_ * 2} 0..$#list/2];
Does the first loop go "too far" down the path of idiomatic perl? Does the second loop give you nasty C flashbacks? Assuming efficiency is not a major concern, did I leave out a more elegant solution?for (my $i = 0; $i <= $#list; $i += 2) { $list[$i] = 'hi'; }
MeowChow s aamecha.s a..a\u$&owag.print
In reply to What would you do? by MeowChow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |