In list context, it returns a list of values counting (up
by ones) from the left value to the right value. If the
left value is greater than the right value then it returns
the empty list.
####
#!/usr/bin/perl -w
use strict;
use warnings;
my @range = ('e' .. 'd');
printf "%s\n", join(" ", @range);
####
e f g h i j k l m n o p q r s t u v w x y z
####
#!/usr/bin/perl -w
use strict;
use warnings;
sub letters {
foreach my $letter ('a' .. 'c', 'd' .. 'f') {
print " $letter";
$letter = uc $letter;
}
print "\n";
}
letters();
letters();
letters();
####
a b c d e f
A B C D E F
A B C D E F
####
$letter = uc $letter;
####
sub letters {
foreach my $letter ('a' .. 'f') {
print " $letter";
$letter = uc $letter;
}
print "\n";
}
# Prints...
a b c d e f
a b c d e f
a b c d e f
####
sub letters {
my @letters = ('a' .. 'c', 'd' .. 'f');
foreach my $letter (@letters) {
print " $letter";
$letter = uc $letter;
}
print "\n";
}
# Prints...
a b c d e f
a b c d e f
a b c d e f