diff options
author | Mark-Jason Dominus <mjd@plover.com> | 2000-10-27 17:32:44 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-10-28 17:20:54 +0000 |
commit | 74fc8b5f8692dff5588f277354ab3b18d362de31 (patch) | |
tree | 6857d1e6b887a2e07bd40bd2fcfe198de2b8d65c /pod | |
parent | de32c8202d339b99659a05330df727455287b1fd (diff) | |
download | perl-74fc8b5f8692dff5588f277354ab3b18d362de31.tar.gz |
DOC PATCH 5.6.0
Message-ID: <20001027173244.23754.qmail@plover.com>
p4raw-id: //depot/perl@7470
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perlfunc.pod | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 31fa5dc100..c502bf7b39 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -1193,7 +1193,7 @@ make your program I<appear> to run faster. When called in list context, returns a 2-element list consisting of the key and value for the next element of a hash, so that you can iterate over -it. When called in scalar context, returns the key for only the "next" +it. When called in scalar context, returns only the key for the next element in the hash. Entries are returned in an apparently random order. The actual random @@ -1208,7 +1208,14 @@ again. There is a single iterator for each hash, shared by all C<each>, C<keys>, and C<values> function calls in the program; it can be reset by reading all the elements from the hash, or by evaluating C<keys HASH> or C<values HASH>. If you add or delete elements of a hash while you're -iterating over it, you may get entries skipped or duplicated, so don't. +iterating over it, you may get entries skipped or duplicated, so +don't. Exception: It is always safe to delete the item most recently +returned by C<each()>, which means that the following code will work: + + while (($key, $value) = each %hash) { + print $key, "\n"; + delete $hash{$key}; # This is safe + } The following prints out your environment like the printenv(1) program, only in a different order: |