Commit | Line | Data |
378cc40b |
1 | #!./perl |
2 | |
79072805 |
3 | # $RCSfile: delete.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:44 $ |
378cc40b |
4 | |
a0d0e21e |
5 | print "1..7\n"; |
378cc40b |
6 | |
7 | $foo{1} = 'a'; |
8 | $foo{2} = 'b'; |
9 | $foo{3} = 'c'; |
10 | |
11 | $foo = delete $foo{2}; |
12 | |
a687059c |
13 | if ($foo eq 'b') {print "ok 1\n";} else {print "not ok 1 $foo\n";} |
14 | if ($foo{2} eq '') {print "ok 2\n";} else {print "not ok 2 $foo{2}\n";} |
378cc40b |
15 | if ($foo{1} eq 'a') {print "ok 3\n";} else {print "not ok 3\n";} |
16 | if ($foo{3} eq 'c') {print "ok 4\n";} else {print "not ok 4\n";} |
17 | |
18 | $foo = join('',values(foo)); |
19 | if ($foo eq 'ac' || $foo eq 'ca') {print "ok 5\n";} else {print "not ok 5\n";} |
20 | |
a687059c |
21 | foreach $key (keys foo) { |
378cc40b |
22 | delete $foo{$key}; |
23 | } |
24 | |
25 | $foo{'foo'} = 'x'; |
26 | $foo{'bar'} = 'y'; |
27 | |
28 | $foo = join('',values(foo)); |
29 | if ($foo eq 'xy' || $foo eq 'yx') {print "ok 6\n";} else {print "not ok 6\n";} |
a0d0e21e |
30 | |
31 | $refhash{"top"}->{"foo"} = "FOO"; |
32 | $refhash{"top"}->{"bar"} = "BAR"; |
33 | |
34 | delete $refhash{"top"}->{"bar"}; |
35 | @list = keys %{$refhash{"top"}}; |
36 | |
37 | print "@list" eq "foo" ? "ok 7\n" : "not ok 7 @list\n"; |