Re: hash to hash reduction operator

2000-08-13 Thread Tom Hughes
In message <[EMAIL PROTECTED]> "Ed Mills" <[EMAIL PROTECTED]> wrote: > Particularly useful for tied hashes using GDBM where the key is actually a > compound key such as 'Tom Smith+Mycity+NY+13404' we could find all NY-ers > using > > foreach (keys %h) {if (/\+NY\+/) {$h2{$_}=$h{$_}} >

hash to hash reduction operator

2000-08-11 Thread Ed Mills
I now you all will kill me for this but here goes.. this is slow: foreach (keys %h) {if (/some regex/) {$h2{$_}=$h{$_}} } In other words, extract a new hash from an existing one by searching for primary keys matching a regex. (Please don't get off on your solutions to this or syntax c