Hello Basil,
Basil A. Daoust schrieb am Thu, Jun 26, 2008 at 03:08:26AM -0500:
> Why does $hashref->{attributes}{charset} and
> $hashref->{attributes}->{charset} work
> and this fails $hashref{attributes}{charset}?
The strictest way to write this is:
%{$hashref} is a hash (like %{hash})
${$hashref}{'attributes'} is an element (like ${hash}{'key'})
%{ ${$hashref}{'attributes'} } is a hash
${ ${$hashref}{'attributes'} }{'charset'} is an element
Now, you can abbreviate:
%{$hashref} as %$hashref
${$hashref}{'attributes'} as $$hashref{'attributes'}
as $$hashref{attributes}
or $hashref->{'attributes'}
as $hashref->{attributes}
%{ ${$hashref}{'attributes'} } as %{$$hashref{'attributes'}}
as %{$$hashref{attributes}}
or %{$hashref->{'attributes'}}
as %{$hashref->{attributes}}
${ ${$hashref}{'attributes'} }{'charset'}
as ${ ${$hashref}{attributes} }{charset}
as ${ $$hashref{attributes} }{charset}
or ${ $hashref->{attributes} }{charset}
as $hashref->{attributes}->{charset}
as $hashref->{attributes}{charset}
The last step is:
The arrow '->' is optional between braces, brackets and parantheses.
Note:
$hashref->{attributes} is an element of %{$hashref}
$hashref{attributes} is an element of %hashref
For details, see perlref(1).
This is perl.
There is more than one way to write it up.
There is more than one way to screw it up.
Yours,
Ingo
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs