for (my $i=0;$i<@a;++$i){ $b[$i] = $a[$i] - $a[$i+1]; }
I wondered if there was any way to address the "$_ + 1" thought in a map statement. I've been looking for any examples, but I don't find them. Obviously this isn't it, but that's the thought at least.
@b = map{$_ - $_+1}, @a;
In reply to Abusing Map by writch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |