This demonstrates that $1 does not behave like a global variable. However it's listed by Kernel.global_variables as a global variable. And it's named like a global variable.
It may not be a good idea to fix this inconsistent naming, because it may break severaly things. However the fact that $1 and friends are not global variables should be clearly documented. And by the way: Ruby != Perl.
This issue was solved with changeset r36526.
Markus, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
re.c (rb_reg_s_last_match): Update $~ to reference Regexp
documentation about "special global variables". [Bug #6723]
These are described as "Special global variables" and are described as "thread-local and method-local" in the Regexp documentation. I updated a reference to them in re.c, but the existing documentation should be sufficient.