This line will produce a non-integer value with an odd number of
elements, which can't be an index of an array.
If you use the following at the top of your scripts and make the
necessary corrections for it to compile, it will make your life
easier and your code better.
Update: I see now that an array can be indexed
with a non-integer value, effectively truncating the fractional
part. I'm surprised that gives no warning.
use feature 'say';
my @list = 0..9;
say $list[2.99]; # all these print '2'
is correct of course about the sort, which is something
that enabling 'strict' and 'warnings' would pick up.