From: Dave Bass Date: 2008-06-06T20:31:59+09:00 Subject: Re: A crosspost from the Perl Community Eric Mahurin wrote: > No, ruby is still call-by-value. The "value" is an object reference > (or simply an object in ruby terms). So you pass a reference to a function. Isn't this call-by-reference??? Whatever the technicalities, what I mean is this. In Perl: sub upper { my $x = shift; $x =~ tr/a-z/A-Z/; } $a = "hello"; upper($a); print $a; # => "hello" $a is unchanged because $x is a local copy of $a; changing $x leaves $a unchanged. But in Ruby: def upper(x) x.upcase! end a = "hello" upper(a) print a # => "HELLO" The original a is changed because upper has direct access to it. You can get the same effect in Perl using explicit referencing and dereferencing: sub upper { my $x = shift; $$x =~ tr/a-z/A-Z/; } $a = "hello"; upper(\$a); print $a; # => "HELLO" Dave -- Posted via http://www.ruby-forum.com/.