Ruby 为什么str.scan在运行文件时不工作?

Ruby 为什么str.scan在运行文件时不工作?,ruby,Ruby,当我尝试运行我的文件时 $ruby file.rb 我明白了 我错过了我需要的东西 修正:我丢失了变量名 str变量应在文件.rb中初始化。例如: str = ' +45754646467 ' 然后你做什么 @file_split = str.scan(/ \+\d{11} /) 什么是str?缺少一个变量。能否显示定义str的位置。 str = ' +45754646467 ' @file_split = str.scan(/ \+\d{11} /)

当我尝试运行我的文件时

$ruby file.rb

我明白了

我错过了我需要的东西


修正:我丢失了变量名

str
变量应在
文件.rb
中初始化。例如:

str = ' +45754646467 '
然后你做什么

@file_split = str.scan(/ \+\d{11} /)

什么是
str
?缺少一个变量。能否显示定义str的位置。
str = ' +45754646467 '
@file_split = str.scan(/ \+\d{11} /)