diff options
author | Tassilo von Parseval <tassilo.parseval@post.rwth-aachen.de> | 2003-12-07 17:41:16 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-12-07 21:28:13 +0000 |
commit | 47b1b33c554896606d6ccea2662feb267c51cf40 (patch) | |
tree | b963ff3ee1c92ffd5121d3641da8cade09f85bd7 /pod/perltie.pod | |
parent | ed25396338133f61e03f805417cf71c3369ece94 (diff) | |
download | perl-47b1b33c554896606d6ccea2662feb267c51cf40.tar.gz |
documenting SCALAR gotcha
Message-id: <20031207154116.GA825@ethan>
p4raw-id: //depot/perl@21865
Diffstat (limited to 'pod/perltie.pod')
-rw-r--r-- | pod/perltie.pod | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pod/perltie.pod b/pod/perltie.pod index 327af04b54..30a0b1df20 100644 --- a/pod/perltie.pod +++ b/pod/perltie.pod @@ -768,6 +768,12 @@ the hash is inside an iteration. If this isn't the case, FIRSTKEY is called, and the result will be a false value if FIRSTKEY returns the empty list, true otherwise. +However, you should B<not> blindly rely on perl always doing the right +thing. Particularly, perl will mistakenly return true when you clear the +hash by repeatedly calling DELETE until it is empty. You are therefore +advised to supply your own SCALAR method when you want to be absolutely +sure that your hash behaves nicely in scalar context. + In our example we can just call C<scalar> on the underlying hash referenced by C<$self-E<gt>{LIST}>: |