Peter Cornelius am Montag, 29. Mai 2006 05.30: > On May 27, 2006, at 3:56 PM, chen li wrote: > > Based on what I learn the regular method to defer a > > hash reference to get specific value takes this > > format: > > > > $ref_hash->{key1} > > > > but in this line > > $_[0]->{_name}= $_[1] if defined $_[1] > > > > the format is > > array element->{_name} > > Yes, the contents of the array element is a hash ref. You could > rewrite this to be the equivalent > > ${$_[0]}->{_name} = $_[1] if defined $_[1]
I guess you meant ${$_[0]}{_name} ${$_[0]}{_name} and $_[0]->{_name} are equivalent, both '->' and ${} dereference the hashref. [...] > I guess this hash reference is being implicitly passed in by the > method call as part of Perl's OOP implementation so you never do see > the actual parameter passage of This different usage of the '->' operator in OOP may be another source of confusion. Class method: MyClass->new(@arguments) implicitly passes @arguments preceeded by the string 'MyClass' to new() Object method: $obj->handle(@arguments) implicitly passes @arguments preceeded by the object $obj to handle() Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>