From: Yohanes Santoso Date: 2002-02-19T07:57:50+09:00 Subject: Re: hash question Sean Russell writes: > Yohanes Santoso wrote: > > > I don't think there will be any improvement. Assuming that the syntax > > hash[/^b/].each works, then each element still has to be visited for > > I'd expect it to be worse, more like O(2n) rather than O(n), because you're > doing one itteration for the hash match, and another for the actual > evaluation. > > v- 1 + v- 1 > hash[/^b].each {|k,v| > print k, " -> ", v, "\n" if k =~ ^b ^^^^^^^^^^ oops, I didn't see that. I think the original poster left it there by mistake, and I was half-blind. YS.