Printing ranges with Perl

When developing Perl scripts, it is often useful to process a range of characters or numbers. This is easily accomplished with Perl’s “..” range operator:

$ perl -e ‘foreach (1 .. 10 ) { print “$_\n”; }’
1
2
3
4
5
6
7
8
9
10

Perl seems to contain just about everything, and is definitely the Cadillac of programming lanaguages.

Leave a Reply

Your email address will not be published. Required fields are marked *