line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
32
|
|
|
32
|
|
320
|
use Perlmazing qw(isa_array list_context scalar_context); |
|
32
|
|
|
|
|
99
|
|
|
32
|
|
|
|
|
207
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
sub main (\@) { |
4
|
0
|
|
|
0
|
|
|
my $arr = shift; |
5
|
0
|
0
|
|
|
|
|
$arr = [$arr, @_] unless isa_array $arr; |
6
|
0
|
|
|
|
|
|
my @copy = @$arr; |
7
|
0
|
|
|
|
|
|
my @duplicates; |
8
|
|
|
|
|
|
|
my $seen; |
9
|
0
|
|
|
|
|
|
my $undef = undef; |
10
|
0
|
|
|
|
|
|
$undef = bless \$undef, 'undef'; |
11
|
0
|
|
|
|
|
|
for (my $i = 0; $i < @copy; $i++) { |
12
|
0
|
0
|
|
|
|
|
$copy[$i] = $undef if not defined $copy[$i]; |
13
|
0
|
0
|
|
|
|
|
if ($seen->{$copy[$i]}) { |
14
|
0
|
|
|
|
|
|
push @duplicates, splice @copy, $i, 1; |
15
|
0
|
|
|
|
|
|
$i--; |
16
|
|
|
|
|
|
|
} else { |
17
|
0
|
|
|
|
|
|
$seen->{$copy[$i]} = 1; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
} |
20
|
0
|
|
|
|
|
|
for my $i (@copy) { |
21
|
0
|
0
|
0
|
|
|
|
$i = undef if ref($i) and ref($i) eq 'undef' and $i eq $undef; |
|
|
|
0
|
|
|
|
|
22
|
|
|
|
|
|
|
} |
23
|
0
|
0
|
|
|
|
|
if (list_context()) { |
|
|
0
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
return @copy; |
25
|
|
|
|
|
|
|
} elsif (scalar_context()) { |
26
|
0
|
|
|
|
|
|
return scalar @duplicates; |
27
|
|
|
|
|
|
|
} else { |
28
|
0
|
|
|
|
|
|
@$arr = @copy; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|