Neil Stevens <neil / hakubi.us> writes:

> James Edward Gray II wrote:
>> Also, I believe they are thread-local variables are they not?  (I'm 
>> honestly asking.)  If so, I don't see a lot of concern about them  being
>> stomped on before they are used.
>
> Actually, I just looked it up, and according to "Programming Ruby,"
> $1-$9 are "local to the current scope."
>
> My mistake, heh.  I wonder how many who use them know that, though, and
> how many just do it without checking because it's popular in perl or
> popular on here.

Actually, these variables are thread-local in Perl too:

  use strict;
  use threads;
  
  "foo" =~ /(\w+)/;
  print($1, "\n");
  threads->new(sub {
  	       "bar" =~ /(\w+)/;
  	       print($1, "\n");
  	     })->join;
  print($1, "\n");

prints:
  
  foo
  bar
  foo

> Neil Stevens - neil / hakubi.us
-- 
Christian Neukirchen  <chneukirchen / gmail.com>  http://chneukirchen.org