如果我用十个捕获的正则表达式进行匹配:
/(o)(t)(th)(f)(fi)(s)(se)(e)(n)(t)/.match("otthffisseent")
然后,对于$10
,我得到:
$10 # => "t"
但它从global_variables
. 我得到(在 irb 会话中):
[:$;, :$-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]
这里只列出前九个:
$1, :$2, :$3, :$4, :$5, :$6, :$7, :$8, :$9
这也证实了:
global_variables.include?(:$10) # => false
存储在哪里$10
,为什么不存储在global_variables
?