Next Tricks of the Wizards 58

Tied Hash Example

        package Insensitive;
        sub TIEHASH {
          my ($package) = @_;
          my $object = {};
          bless $object => $package;
        }
        sub STORE {
          my ($self, $key, $value) = @_;
          $self->{lc $key} = $value;
        }
        sub FETCH {
          my ($self, $key) = @_;
          $self->{lc $key};
        }


Next Copyright © 2003 M. J. Dominus