In Perl I used to do this:

print 'Enter data: ';
chomp(my $in = <STDIN>);

sub doit {
   my $data = shift;
   .........
   return $data;
}

doit($in);


In Ruby the equivalent seems to be:

puts 'Enter data: '
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?

gvim