File: each.t

package info (click to toggle)
libset-scalar-perl 1.29-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 240 kB
  • sloc: perl: 932; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 359 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use Set::Scalar;

print "1..2\n";

my @a = ("a".."e",0);
my $a = Set::Scalar->new(@a);

my $e;
my %e;

while (defined($e = $a->each)) {
    print "# e = $e\n";
    $e{$e}++;
}

print "not " if defined $e;
print "ok 1\n";

my $n;

for my $e (@a) {
    $n++ if exists $e{$e} && $e{$e} == 1;
}

print "not " unless $n == @a && keys %e == @a;
print "ok 2\n";