Clownfish::Hash - Hashtable.
my $hash = Clownfish::Hash->new; $hash->store($key, $value); my $value = $hash->fetch($key);
Values are stored by reference and may be any kind of Obj.
my $hash = Clownfish::Hash->new( capacity => $capacity, # default: 0 );
Return a new Hash.
capacity - The number of elements that the hash will be asked to hold initially.
$hash->clear();
Empty the hash of all key-value pairs.
$hash->store($key, $value);
Store a key-value pair.
my $obj = $hash->fetch($key);
Fetch the value associated with key.
key
Returns: the value, or undef if key is not present.
my $obj = $hash->delete($key);
Attempt to delete a key-value pair from the hash.
Returns: the value if key exists and thus deletion succeeds; otherwise undef.
my $bool = $hash->has_key($key);
Indicate whether the supplied key is present.
my $arrayref = $hash->keys();
Return the Hash’s keys.
my $arrayref = $hash->values();
Return the Hash’s values.
my $int = $hash->get_size();
Return the number of key-value pairs.
Clownfish::Hash isa Clownfish::Obj.
To install Clownfish, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Clownfish
CPAN shell
perl -MCPAN -e shell install Clownfish
For more information on module installation, please visit the detailed CPAN module installation guide.