This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 1.0 patch 14: a2p incorrectly translates 'for (a in b)' construct.
[perl5.git] / t / op.each
CommitLineData
8d063cd8
LW
1#!./perl
2
3# $Header: op.each,v 1.0 87/12/18 13:13:23 root Exp $
4
5print "1..2\n";
6
7$h{'abc'} = 'ABC';
8$h{'def'} = 'DEF';
9$h{'jkl'} = 'JKL';
10$h{'xyz'} = 'XYZ';
11$h{'a'} = 'A';
12$h{'b'} = 'B';
13$h{'c'} = 'C';
14$h{'d'} = 'D';
15$h{'e'} = 'E';
16$h{'f'} = 'F';
17$h{'g'} = 'G';
18$h{'h'} = 'H';
19$h{'i'} = 'I';
20$h{'j'} = 'J';
21$h{'k'} = 'K';
22$h{'l'} = 'L';
23$h{'m'} = 'M';
24$h{'n'} = 'N';
25$h{'o'} = 'O';
26$h{'p'} = 'P';
27$h{'q'} = 'Q';
28$h{'r'} = 'R';
29$h{'s'} = 'S';
30$h{'t'} = 'T';
31$h{'u'} = 'U';
32$h{'v'} = 'V';
33$h{'w'} = 'W';
34$h{'x'} = 'X';
35$h{'y'} = 'Y';
36$h{'z'} = 'Z';
37
38@keys = keys(h);
39@values = values(h);
40
41if ($#keys == 29 && $#values == 29) {print "ok 1\n";} else {print "not ok 1\n";}
42
43while (($key,$value) = each(h)) {
44 if ($key eq $keys[$i] && $value eq $values[$i] && $key gt $value) {
45 $key =~ y/a-z/A-Z/;
46 $i++ if $key eq $value;
47 }
48}
49
50if ($i == 30) {print "ok 2\n";} else {print "not ok 2\n";}