Table of Contents

For loops with .. , the range operator

There is a another version:

for $x (0 .. $#names) {
        print "$names[$x]\n";
}

which takes advantage of the range operator .. (two dots together). This simply gives $x the value of 0, then increments $x by 1 until it is equal to $#names .