
| Contents |
|||||||||||||||||||||||||||||
| [an error occurred while processing this directive] |
3.2 List LiteralsLike scalars, it is possible to write lists as literals right in your code. Of course, as with inserting string literals in your code, you must use proper quoting.
There are two primary ways to quote list literals that we will discuss
here. One is using
Here are a few examples of some list literals, using both
(); # this list has no elements; the empty list qw//; # another empty list ("a", "b", "c", 1, 2, 3); # a list with six elements qw/hello world how are you today/; # another list with six elements
Note that when we use the
Finally, if you have any two scalar values where all the values between
them can be enumerated, you can use an operator called the
(1 .. 100); # a list of 100 elements: the numbers from 1 to 100 ('A' .. 'Z'); # a list of 26 elements: the uppercase letters From A to Z ('01' .. '31'); # a list of 31 elements: all possible days of a month # with leading zeros on the single digit days
You will find the
|