Martin H. Sluka > Tie-Hash-Array > Tie::Hash::Abbrev::Smart

Download:
Tie-Hash-Array-0.1.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Tie::Hash::Abbrev::Smart - a hash which can be accessed using abbreviated keys

SYNOPSIS ^

  use Tie::Hash::Abbrev::Smart;

  tie my %hash, 'Tie::Hash::Abbrev::Smart';

  %hash = ( sonntag   =>0, montag =>1, dienstag=>2, mittwoch =>3,
            donnerstag=>4, freitag=>5, samstag =>6,
            sunday    =>0, monday =>1, tuesday =>2, wednesday=>3,
            thursday  =>4, friday =>5, saturday=>6 );

  print $hash{do}; # will print "4"
  print $hash{fr}; # will print "5"
  print $hash{t};  # undef

  my @deleted = tied(%hash)->delete_abbrev(qw(do fr t));
    # will delete elements "donnerstag", "freitag" and "friday";
      @deleted will be (4,5,5)

DESCRIPTION ^

This module implements a subclass of Tie::Hash::Abbrev. The contents of hashes tied to this class may be accessed via unambiguously abbreviated keys. (Please note, however, that this is not true for deleting hash elements; for that you can use "delete_abbrev()" in Tie::Hash::Abbrev via the object interface.)

In contrast to Tie::Hash::Abbrev, an abbreviation is still considered to be unambiguous even if more than one key starting with the respective string exists, as long as all of the corresponding elements have identical (string) values.

BUGS ^

None known so far.

AUTHOR ^

        Martin H. Sluka
        mailto:perl@sluka.de
        http://martin.sluka.de/

COPYRIGHT ^

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO ^

Tie::Hash::Abbrev

syntax highlighting: