in reply to Square the array values.

I'd just:

my @arr = map {$_ * $_} qw( 1 2 3 4 5 6 7 8);

or if the array already exists:

$_ *= $_ for @arr;

True laziness is hard work