Pre-defined variables $! The exception information message set by 'raise'. $@ Array of backtrace of the last exception thrown. $& The string matched by the last successful match. $` The string to the left of the last successful match. $' The string to the right of the last successful match. $+ The highest group matched by the last successful match. $1 The Nth group of the last successful match. May be > 1. $~ The information about the last match in the current scope. $= The flag for case insensitive, nil by default. $/ The input record separator, newline by default. $\ The output record separator for the print and IO
the above shortcuts are Perl's unsuccessful anachronism! For some of them there are "English names" which do not require explanation and which should be used if available.
see also: http://ruby.runpaint.org/globals
see also: http://www.zenspider.com/Languages/Ruby/QuickRef.html
source share