To generate a list of numbers, Perl provides the syntax
.. (double dots). However, the syntax only provides ascending sequences with 1 increment. What can we do if we need more flexible sequences in Perl?
In the following example, you can see that
.. only generate an ascending sequence.
If you need more flexible iterators or generators, you may check out List::Gen module. This module provides higher order functions, list comprehensions, generators, iterators, and other utility functions.
For example, function
range generates a generator that can be used in loop.
There are still functions worth exploring. You may check the page of List::Gen to find useful functions.