This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 3.0 patch #16 (combined patch)
[perl5.git] / t / op.range
CommitLineData
a687059c
LW
1#!./perl
2
3# $Header: op.range,v 3.0 89/10/18 15:30:53 lwall Locked $
4
5print "1..6\n";
6
7print join(':',1..5) eq '1:2:3:4:5' ? "ok 1\n" : "not ok 1\n";
8
9@foo = (1,2,3,4,5,6,7,8,9);
10@foo[2..4] = ('c','d','e');
11
12print join(':',@foo[$foo[0]..5]) eq '2:c:d:e:6' ? "ok 2\n" : "not ok 2\n";
13
14@bar[2..4] = ('c','d','e');
15print join(':',@bar[1..5]) eq ':c:d:e:' ? "ok 3\n" : "not ok 3\n";
16
17($a,@bcd[0..2],$e) = ('a','b','c','d','e');
18print join(':',$a,@bcd[0..2],$e) eq 'a:b:c:d:e' ? "ok 4\n" : "not ok 4\n";
19
20$x = 0;
21for (1..100) {
22 $x += $_;
23}
24print $x == 5050 ? "ok 5\n" : "not ok 5 $x\n";
25
26$x = 0;
27for ((100,2..99,1)) {
28 $x += $_;
29}
30print $x == 5050 ? "ok 6\n" : "not ok 6 $x\n";