$nerf{"my"} = "fridge"; $nerf{"0"} = "truth"; $nerf{"1"} = "beauty"; @nerf = ('i', 'love', 'cheese'); $_ = 'my funny valentine'; print "print ctxt 1: ", /^(\w*)/, " $&", "\n"; # good - this regex returns the # match b/c it's a list context print "print ctxt 2: ", /^\w*/, " $&", "\n"; # good - this regex returns a # 1 b/c there are no parentheses $x = $nerf{/^(\w*)/}; print "hash ctxt: ", $x, " $&", "\n"; # this regex returns a 1 despite the # parentheses because it wants a scalar # but dammit, i'd like to be able to do regexes # within hash keys $y = $nerf[/^(\w*)/]; print "array ctxt: ", $y, " $&", "\n" # this regex also returns a 1 despite the parentheses