Is $~ thread safe? To bad it has to be done this way (though my library will hide it). I first looked at Ruby several years ago, and at that time, didn't go further with it because it was too PERLish for me. (PERL was great for its time, but speaking as someone who actually had to maintain a lot of PERL code, it's actually a pretty grotty language). One of the things that brought me back to Ruby was the fact that an effort was being made to move Ruby away from its PERLisms. But I guess it'll take a while longer... Thanks everyone, Ken Rick DeNatale wrote: > On 6/3/07, Devin Mullins <twifkak / comcast.net> wrote: >> Nobuyoshi Nakada wrote: >> > String#index also sets $~. >> For that matter, so does String#scan. > > Hence: > irb(main):001:0> "abcdefabc".scan(/abc/) {puts "#{$~.inspect}, #{$~}"} > #<MatchData:0xb7b0220c>, abc > #<MatchData:0xb7b021e4>, abc > => "abcdefabc" >