Re: [code-review] Tie::Hash::RegexKeys
Xavier Noria <[email protected]> Tue, 13 Jan 2004 09:30:25 +0100
| Newsgroups | gmane.comp.lang.perl.code-review-ladder |
|---|---|
| Message-ID | <[email protected]> |
On Jan 13, 2004, at 3:28 AM, Peter Scott wrote:
> I've created another module intended for CPAN at
> http://www.psdt.com/Tie-Hash-RegexKeys-0.01.tar.gz pending review from
> folks here. This allows you to use regexen as hash keys and operate
> on the elements with matching keys. It's not fast when you do that,
> 'cos it scans through potentially all the keys, but it can be useful
> anyway.
If I understand the code correctly, $h{/regex/} = $value updates $value
in all the entries whose key matches /regex/. That's right. But
$h{/regex/} returns just one value, and which one is undefined because
it is the first one in hash order among the ones whose key matches
/regex/.
I think I would expect a list from FETCH, or at least a list if
wantarray.
-- fxn