These variables are predefined for you by ruby.

$* Command line parameters

$” Filenames loaded by the require statements invoked to load your program

$? Status of the recently exited child process invoked by your program

$&, $` and $’ Contains the result of the last successfull regular expression match results.

For ex:
After executing 'The weather forecast is mostly sunny for today' =~ /sunny/
$& will be set to 'sunny'
$` will be set to 'The weather forecast is mostly '
$' will be set to ' for today'

$! contains the last expection object

$@ contains the backtrace of the previous exception object. You can print this using $@.join(“\n”)

$$ contains the PID of the executing process.

$0 contains the name of the currently executing program

$: contains the load path that will be used by ruby load and require methods.

Advertisements