Andrew Maltsev


XAO::SimpleHash - Simple 2D hash manipulations


  use XAO::SimpleHash;

  my $h=new XAO::SimpleHash a => 11, b => 12, c => 13;

  $h->put(d => 14);


  my @keys=$h->keys;


Base object from which various hash-like containers are derived.

Methods are (alphabetical order, PERL API):

  • sub contains ($$)

    Returns key of the element, containing given text. Case is insignificant in comparision.

    If no value found 'undef' is returned.

  • sub defined ($$)

    Boolean method to check if element with given key defined or not. Exactly the same as 'defined ($hash->get($key))'.

  • sub delete ($$)

    Deletes given key from the hash.

  • sub exists ($$)

    Checks if given key exists in the hash or not (regardless of value, which can be undef).

  • sub fill ($@)

    Allows to fill hash with multiple values. Supports variety of argument formats:

       $hash->fill(key1 => value1, key2 => value2, ...);
       $hash->fill({ key1 => value1, key2 => value2, ... });
       $hash->fill([ key1 => value1 ], [ key2 => value2 ], ...);
  • sub get ($$)

    Returns element by given key. Usually called as:


    Support also available for URI:


    Note that leading and trailing slashes are optional in URI.

  • sub getref ($$)

    Return reference to the element by given key or 'undef' if such element does not exist.

  • sub keys ($)

    Returns array of keys.

  • sub new ($;@)

    Creates new hash and pre-fills it with given values. Values are in the same format as in fill().

  • sub put ($$$)

    Puts single key-value pair into hash. Usually called as:

    $hash->put(key => value);

    Support also available for URI:

    $hash->put(/path/to/value => value);

    Note that leading and trailing slashes are optional in URI.

  • sub values ($)

    Returns array of values in the same order as $hash->keys returns keys (on non-modified hash).


In addition to normal Perl style API outlined above XAO::SimpleHash allows developer to use Java style API. Here is the mapping between Perl API and Java API:

  isSet          --  defined
  containsKey    --  exists
  elements       --  values
  remove         --  delete
  containsValue  --  contains




Copyright (c) 1997-2001 XAO Inc.

Authors are Marcos Alves <>, Bil Drury <>, Andrew Maltsev <>.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 540:

You forgot a '=back' before '=head1'