John W. Krahn schrieb:
Kevin Old wrote:
So to achieve an anonymous hash I'd have to do the following, correct?
use constant STOPWORDS => {
'a' => 1,
'about' => 1,
'above' => 1,
'across' => 1,
'adj' => 1,
'after' => 1,
};
Yes, that would store a reference to an anonymous hash in STOPWORDS. Note
that only the reference would be a constant, the hash itself could still be
modified.
After reading this, I read `perldoc constant` where I found just what
was stated here:
...
Even though a reference may be declared as a constant, the reference may
point to data which may be changed, as this code shows.
use constant ARRAY => [ 1,2,3,4 ];
print ARRAY->[1];
ARRAY->[1] = " be changed";
print ARRAY->[1];
Dereferencing constant references incorrectly (such as using an array
subscript on a constant hash reference, or vice versa) will be trapped
at compile time.
...
I find this a Very Useful Information.
Thank you for bringing this to my attention and showing me another way
to do it.
Andreas Pürzer
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>