gvim <gvimrc / gmail.com> wrote:
> in = gets.chomp
> 
> def doit(data)
>   ........
>   return data
> end
> 
> doit(in)
> 
> 
> However, Ruby passes arguments by reference so it seems the variable
> 'data' is always accessing and changing the file-global variable
> 'in'. Is there a more Perl-like, way of lexicalising the scope of
> variables passed as arguments to functions?

Make a copy of the argument when you call the method:

	doit(in.dup)