P
Peng Yu
Hi,
The following code shows that 'z'..'a' is not empty. But perlop says
the following. So it should return empty list. Does anybody know why
'z'..'a' is not empty?
"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."
~/linux/test/perl/man/perlop/dot_dot/list_context$ cat main.pl
#!/usr/bin/env perl
use warnings;
print join(',', 1..10), "\n";
print join(',', 10..1), "\n";
print join(',', 'a'..'z'), "\n";
print join(',', 'z'..'a'), "\n";
~/linux/test/perl/man/perlop/dot_dot/list_context$ ./main.pl
1,2,3,4,5,6,7,8,9,10
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
z
~/linux/test/perl/man/perlop/dot_dot/list_context$ perl --version
This is perl 5, version 14, subversion 2 (v5.14.2) built for darwin-
thread-multi-2level
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2011, Larry Wall
Binary build 1402 [295342] provided by ActiveState http://www.ActiveState.com
Built Oct 7 2011 15:58:41
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source
kit.
Complete documentation for Perl, including FAQ lists, should be found
on
this system using "man perl" or "perldoc perl". If you have access to
the
Internet, point your browser at http://www.perl.org/, the Perl Home
Page.
The following code shows that 'z'..'a' is not empty. But perlop says
the following. So it should return empty list. Does anybody know why
'z'..'a' is not empty?
"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."
~/linux/test/perl/man/perlop/dot_dot/list_context$ cat main.pl
#!/usr/bin/env perl
use warnings;
print join(',', 1..10), "\n";
print join(',', 10..1), "\n";
print join(',', 'a'..'z'), "\n";
print join(',', 'z'..'a'), "\n";
~/linux/test/perl/man/perlop/dot_dot/list_context$ ./main.pl
1,2,3,4,5,6,7,8,9,10
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
z
~/linux/test/perl/man/perlop/dot_dot/list_context$ perl --version
This is perl 5, version 14, subversion 2 (v5.14.2) built for darwin-
thread-multi-2level
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2011, Larry Wall
Binary build 1402 [295342] provided by ActiveState http://www.ActiveState.com
Built Oct 7 2011 15:58:41
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source
kit.
Complete documentation for Perl, including FAQ lists, should be found
on
this system using "man perl" or "perldoc perl". If you have access to
the
Internet, point your browser at http://www.perl.org/, the Perl Home
Page.