The latter is much better, though you could multiply and assign in place with =*:
for (@array) { $_ *= $_; }
... or even use postfix iteration:
$_ *= $_ for @array;In reply to Re^3: Square the array values.
by chromatic
in thread Square the array values.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |