Martin H. Sluka
and 1 contributors


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


  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)


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.


None known so far.


        Martin H. Sluka


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.