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 "_ "; }'

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.

This article was posted by Matty on 2005-10-07 14:29:00 -0400 -0400