Hi Peter, Thank you very much,
Li --- Peter Cornelius <[EMAIL PROTECTED]> wrote: > > 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] > > Using the '{}' around the $_[0] to more clearly mark > it as a reference. > > > Is the middle man $ref_hash is omitted in this > format? > > Does this what Perl really sees: > > > > $_[0]=$ref_hash; > > > > $ref_hash->{_name}; > > > > and put these two lines into one line to make it > > short: > > > > $_[0]->{_name} > > It's not really omitted, rather the argument passed > in was a hash > reference so the first element of the array ($_[0]) > is a hash > reference. You could alias it by saying > > $ref_hash = $_[0]; > > or, if you're feeling confident use it without the > alias, as in this > example. > > 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 > > name($ref_hash, $new_name) > > Is this what's confusing you? > > Hope this helps, > PC > > -- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > <http://learn.perl.org/> > <http://learn.perl.org/first-response> > > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>