1Clownfish::Hash(3) User Contributed Perl Documentation Clownfish::Hash(3)
2
3
4
6 Clownfish::Hash - Hashtable.
7
9 my $hash = Clownfish::Hash->new;
10 $hash->store($key, $value);
11 my $value = $hash->fetch($key);
12
14 Values are stored by reference and may be any kind of Obj.
15
17 new
18 my $hash = Clownfish::Hash->new(
19 capacity => $capacity, # default: 0
20 );
21
22 Return a new Hash.
23
24 ยท capacity - The number of elements that the hash will be asked to
25 hold initially.
26
28 clear
29 $hash->clear();
30
31 Empty the hash of all key-value pairs.
32
33 store
34 $hash->store($key, $value);
35
36 Store a key-value pair.
37
38 fetch
39 my $obj = $hash->fetch($key);
40
41 Fetch the value associated with "key".
42
43 Returns: the value, or undef if "key" is not present.
44
45 delete
46 my $obj = $hash->delete($key);
47
48 Attempt to delete a key-value pair from the hash.
49
50 Returns: the value if "key" exists and thus deletion succeeds;
51 otherwise undef.
52
53 has_key
54 my $bool = $hash->has_key($key);
55
56 Indicate whether the supplied "key" is present.
57
58 keys
59 my $arrayref = $hash->keys();
60
61 Return the HashXs keys.
62
63 values
64 my $arrayref = $hash->values();
65
66 Return the HashXs values.
67
68 get_size
69 my $int = $hash->get_size();
70
71 Return the number of key-value pairs.
72
74 Clownfish::Hash isa Clownfish::Obj.
75
76
77
78perl v5.32.0 2020-07-28 Clownfish::Hash(3)