line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hash::Unique; |
2
|
2
|
|
|
2
|
|
1124
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
56
|
|
3
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
310
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = "0.06"; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub get_unique_hash { |
8
|
1
|
|
|
1
|
1
|
191535
|
my $class = shift; |
9
|
1
|
|
|
|
|
6
|
my ($array_hash, $key) = @_; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
|
|
2
|
my @tmp; |
12
|
1
|
|
|
|
|
3
|
my @return_hash = (); |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
5
|
foreach my $hash (@$array_hash) { |
15
|
100000
|
100
|
|
|
|
182253
|
if (!in_array($hash->{$key}, \@tmp)) { |
16
|
7
|
|
|
|
|
12
|
push (@return_hash, $hash); |
17
|
7
|
|
|
|
|
18
|
push (@tmp, $hash->{$key}); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
13
|
return @return_hash; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub in_array { |
25
|
100000
|
|
|
100000
|
0
|
158604
|
my ($val, $array_ref) = @_; |
26
|
|
|
|
|
|
|
|
27
|
100000
|
|
|
|
|
147530
|
foreach my $elem (@$array_ref) { |
28
|
399788
|
100
|
|
|
|
761620
|
if ($val eq $elem) { |
29
|
99993
|
|
|
|
|
226993
|
return 1; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
7
|
|
|
|
|
51
|
return 0; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
__END__ |