in reply to Why does the first $c evaluate to the incremented value in [$c, $c += $_] ?
Very strange indeed. And it doesn't even have to be a state variable, i.e.
my $c = 0; my @partitions = map { [$c, $c += $_] } @widths;
gives the same result.
Whereas [$c+0, $c += $_] produces
and so does [my $tmp = $c, $c += $_][0, 2] [2, 8] [8, 13] [13, 20]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why does the first $c evaluate to the incremented value in [$c, $c += $_] ?
by derby (Abbot) on Mar 04, 2014 at 21:23 UTC |