Rudolf Polzer wrote: > >BTW, why this: > >irb(main):001:0> a = "Hello" >=> "Hello" >irb(main):002:0> class << a >irb(main):003:1> def =~(x) >irb(main):004:2> p [:you, :lose] >irb(main):005:2> end >irb(main):006:1> end >=> nil >irb(main):007:0> a =~ /./ >=> 0 >irb(main):008:0> a.=~ /./ >[:you, :lose] >=> nil > >What did I do wrong? > This seem to work if you put the regexp with brackets: a=~ (/./) My guess it's an assumption by the parser used to speed up execution, where you have a variable in the left, and regexp syntax on right, with no additional evaling requirements(such as brackets) See this code: a="aaa" 1.upto(1000000) do a=~/./ end time: real 0m2.992s user 0m2.860s sys 0m0.060s Add brackets and you have: real 0m3.362s user 0m3.300s sys 0m0.050s Idan