If I do a match with a regular expression with ten captures:
/(o)(t)(th)(f)(fi)(s)(se)(e)(n)(t)/.match("otthffisseent")
then, for $10
, I get:
$10 # => "t"
but it is missing from global_variables
. I get (in an irb session):
[:$;, :$-F, :$@, :$!, :$SAFE, :$~, :$&, :$`, :$', :$+, :$=, :$KCODE, :$-K, :$,,
:$/, :$-0, :$\, :$_, :$stdin, :$stdout, :$stderr, :$>, :$<, :$., :$FILENAME,
:$-i, :$*, :$?, :$$, :$:, :$-I, :$LOAD_PATH, :$", :$LOADED_FEATURES,
:$VERBOSE, :$-v, :$-w, :$-W, :$DEBUG, :$-d, :$0, :$PROGRAM_NAME, :$-p, :$-l,
:$-a, :$binding, :$1, :$2, :$3, :$4, :$5, :$6, :$7, :$8, :$9]
Here, only the first nine are listed:
$1, :$2, :$3, :$4, :$5, :$6, :$7, :$8, :$9
This is also confirmed by:
global_variables.include?(:$10) # => false
Where is $10
stored, and why isn’t it stored in global_variables
?