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 itteration over the elements
hash.each {|k,v|
  print k, " -> ", v, "\n" if k =~ ^b
}


     v- 1 + v- 1
hash[/^b].each {|k,v|
  print k, " -> ", v, "\n" if k =~ ^b
}



-- 
 |..  "I didn't claw my way to the top of the food chain to eat
<|>    vegetables."
/|\   -- anon
/|    
 |