From: Markus Jais Date: 2002-02-18T20:47:10+09:00 Subject: hash question hello I read in the pickaxe book that I can also use a Regexp as a hash key lets says I have this code: hash = Hash.new hash["bird"] = "vogel" hash["lynx"] = "luchs" hash["snake"] = "schlange" hash.each {|k,v| print k, " -> ", v, "\n" if k =~ /^b/ } the output is of course: bird -> vogel but I like to use the regexp /^b/ before the block something like hash[/^b].each {|k,v| print k, " -> ", v, "\n" if k =~ /^b/ } but this does not work. I thought that if this would work it could be faster because the block is only called for the keys which macht the regexp. any ideas how this could be done. if I have just overlooked the section in the pickaxe book please let me know where I can find it. thanks markus