Q:

Can I have a local variable in Ruby be named "$name", without it becoming a global variable?

So in php the notation for a standard variable is:
$ so $name = 'bob'
but in ruby $name = 'bob' would be a global variable.
but lets say you would like $name to be a standard variable like it is in php.
Can you escape $name in ruby so its not a global anymore?

A:

No, sorry, Ruby does not support having a local variable begin with $:
pry(main)> binding.local_variable_set '$foo', [1,2,3,4]
NameError: wrong local variable name `$foo' for #<Binding:0x00007ff71dddac18>

Directly from the Ruby docs:

A local variable name must start with a lowercase US-ASCII letter or a character with the eight bit set.

update
(hilariously) "yes, but not really", since Ruby supports Unicode:

pry(main)>  = 4
=> 4
pry(main)> 
=> 4
pry(main)> name = [1,2,3]
=> [1, 2, 3]
pry(main)> name
=> [1, 2, 3]
pry(main)> ﹩name = 'asdf'
=> "asdf"
pry(main)> ﹩name
=> "asdf"
pry(main)> ＄name = false
=> false
pry(main)> ＄name
=> false

