on Thu, 30 May 2002 04:20:43 GMT, [EMAIL PROTECTED] (Eric Beaudoin) wrote:
> You might want to change [@user] to \@user if you really want to > refence that array instead of referencing a new copy of the array. > I'm not 100% sure but I don't think [@user] is the same as \@user. You're right, it isn't. [@user] indeed creates a fresh, independent copy, while \@user doesn't, as shown by the following code: #! perl -w use strict; my $aref1; my $aref2; my @array = (1,2,3,4); $aref1 = \@array; $aref2 = [@array]; print "Before\n"; print "aref1 -> @$aref1\n"; print "aref2 -> @$aref2\n"; $array[1] = 'x'; print "After\n"; print "aref1 -> @$aref1\n"; # prints 1 x 3 4 print "aref2 -> @$aref2\n"; # prints 1 2 3 4 -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]