NAME Tie::RegexpHash - Use regular expressions as hash keys REQUIREMENTS "Tie::RegexpHash" is written for and tested on Perl 5.6.0, but should run with Perl 5.005. (Because it uses Regexp variables it cannot run on earlier versions of Perl.) It uses only standard modules. Installation Installation is pretty standard: perl Makefile.PL make make test make install HISTORY Changes since v0.10 0.12 22 Nov 2002 - fixed bug with logic in _find() routine 0.11 27 Jan 2001 - added SEE ALSO in POD about Tie::Hash::Regex - should run on Perl 5.005 - no longer an Exporter - added stub for test suite SYNOPSIS use Tie::RegexpHash; my %hash; tie %hash, 'Tie::RegexpHash'; $hash{ qr/^5(\s+|-)?gal(\.|lons?)?/i } = '5-GAL'; $hash{'5 gal'}; # returns "5-GAL" $hash{'5GAL'}; # returns "5-GAL" $hash{'5 gallon'}; # also returns "5-GAL" my $rehash = Tie::RegexpHash->new(); $rehash->add( qr/\d+(\.\d+)?/, "contains a number" ); $rehash->add( qr/s$/, "ends with an \`s\'" ); $rehash->match( "foo 123" ); # returns "contains a number" $rehash->match( "examples" ); # returns "ends with an `s'" DESCRIPTION This module allows one to use regular expressions for hash keys, so that values can be associated with anything that matches the key. Hashes can be operated on using the standard tied hash interface in Perl, or using an object-orineted interface described below. A more detailed description can be found in the POD AUTHOR Robert Rothenberg Acknowledgements Simon Hanmer & Bart Vetters for pointing out a bug in the logic of the _find() routine in v0.10. SEE ALSO "Tie::Hash::Regex" is a module with a complimentary function. Rather than a hash with Regexps as keys that match a fetch, this module has standard keys but uses Regexps for fetches. LICENSE Copyright (c) 2001-2002 Robert Rothenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.