> In T::R, the keys that you use in the hash are all treated as regexes. In
> effect you're saying "if you look up a value using a key that matches this
> regex, then return this value". An added complication is that the key/value
> pairs are _ordered_ (the underlying object is an array, not a hash) so that
> you can guarantee that the regexes are checked in the same order as you
> added them to the hash.
>
> It's all very clever, but I'm not convinced how useful it is[2]. And it took
> a whole bunch more implementation than T::H::R did. Oh, and it's written for
> Perl 5.6, but the only reason I can see is so the author can 'use warnings'.
I have wrote something in 1997 that needed exactly this (although I
never dreamed of looking at CPAN for a module to do something so
simple):
I need to do a "whois" lookup for a domain name. Different domain
names need to be looked up on different whois servers. So I have a
list of domains and their relevant whois server, like: "co.uk" =>
"whois.nic.uk". So I can look for, e.g., "test.co.uk" in the list and
know that I need to query "whois.nic.uk" for info about that domain.
--
sigs are for whimps