You can rewrite it like this: for my $y (0..@x)
You mean: for my $y (0..$#x)
In reply to Re^2: Initialization of arrays by ikegami in thread Initialization of arrays by Anonymous Monk