for (my $x = 0; $x <= $#arr; $x++) {} # ^^ # up to *and including* the last index for (my $x = 0; $x < @arr; $x++) {} # ^ # when used in scalar context, '@arr' returns the number of # elements in @arr