As per the Perl documentation of my,I think you are looking for something like below in Ruby:-
x = 123
p = Proc.new {|;x|
x = 'I do not want change the value of the outer x, I want to create a local x'
}
p.call
# => "I do not want change the value of the outer x, I want to create a local x"
x # => 123