diff options
author | Gisle Aas <gisle@aas.no> | 1998-06-24 22:26:48 +0200 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-06-28 19:44:19 +0000 |
commit | b3a6eca56a296f8a280152acdec4f2ba0d27ed45 (patch) | |
tree | c7e55c90b8da9656b7bb2b9467f183842bed6aae /t/op/range.t | |
parent | 1e46e1c93a052791cc414dad1fd4477575793d8f (diff) | |
download | perl-b3a6eca56a296f8a280152acdec4f2ba0d27ed45.tar.gz |
Optimize foreach (1..1000000)
Message-ID: <m3lnqmwt93.fsf@furu.g.aas.no>
p4raw-id: //depot/perl@1239
Diffstat (limited to 't/op/range.t')
-rwxr-xr-x | t/op/range.t | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/t/op/range.t b/t/op/range.t index 746da46800..7999b869cb 100755 --- a/t/op/range.t +++ b/t/op/range.t @@ -1,8 +1,6 @@ #!./perl -# $RCSfile: range.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:14 $ - -print "1..8\n"; +print "1..10\n"; print join(':',1..5) eq '1:2:3:4:5' ? "ok 1\n" : "not ok 1\n"; @@ -34,3 +32,17 @@ print $x eq 'abcdefghijklmnopqrstuvwxyz' ? "ok 7\n" : "not ok 7 $x\n"; @x = 'A'..'ZZ'; print @x == 27 * 26 ? "ok 8\n" : "not ok 8\n"; + +@x = '09' .. '08'; # should produce '09', '10',... '99' (strange but true) +print "not " unless join(",", @x) eq + join(",", map {sprintf "%02d",$_} 9..99); +print "ok 9\n"; + +# same test with foreach (which is a separate implementation) +@y = (); +foreach ('09'..'08') { + push(@y, $_); +} +print "not " unless join(",", @y) eq join(",", @x); +print "ok 10\n"; + |