Ruby predefined read-only variable
在這個網址下有個List
http://www.math.hokudai.ac.jp/~gotoken/ruby/ruby-uguide/uguide20.html
$! error message
$@ position of an error occurrence
$_ latest read string by `gets'
$. latest read number of line by interpreter
$& latest matched string by the regexep.
$1, $2... latest matched string by nth parentheses of regexp.
$~ data for latest matche for regexp
$= whether or not case-sensitive in string matching
$/ input record separator
$\ output record separator
$0 the name of the ruby scpript file
$* command line arguments for the ruby scpript
$$ PID for ruby interpreter
$? status of the latest executed child process
順手補上一個...
$: 會印出Ruby Path
沒有留言:
張貼留言