Ruby的一些常用全局变量
阅读原文时间:2023年07月12日阅读:1

$!

latesterror message

$@

locationof error

$_

stringlast read by gets

$.

linenumber last read by interpreter

$&

stringlast matched by regexp

$~

thelast regexp match, as an array of subexpressions

$n

thenth subexpression in the last match (same as $~[n])

$=

case-insensitivityflag

$/

inputrecord separator

$\

outputrecord separator

$0

thename of the ruby script file

$thecommand line arguments

$$

interpreter’sprocess ID

$?

exit status of last executed child process

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章