summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSmylers <Smylers@stripey.com>2018-06-07 16:17:33 +0100
committerDavid Mitchell <davem@iabyn.com>2018-06-18 14:10:29 +0100
commit4d31efb6c54b7fc01111d262a523c115d3ff533d (patch)
tree81f14d1fd245064ff283c7f5897d519a08c0e360
parenteefffb17d642061c02ee20eb2929449b00b6f33b (diff)
downloadperl-4d31efb6c54b7fc01111d262a523c115d3ff533d.tar.gz
Document delete %hash{key} return value
cc0776d64 introduced delete on key-value hash slices. That intuitively returns a list of key- value pairs, which is two elements per specified hash key. Update the docs to reflect this.
-rw-r--r--pod/perlfunc.pod9
1 files changed, 6 insertions, 3 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index fa08d4c3e9..b55068f1f9 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -1595,10 +1595,13 @@ so that L<C<exists>|/exists EXPR> on that element no longer returns
true. Setting a hash element to the undefined value does not remove its
key, but deleting it does; see L<C<exists>|/exists EXPR>.
-In list context, returns the value or values deleted, or the last such
-element in scalar context. The return list's length always matches that of
+In list context, usually returns the value or values deleted, or the last such
+element in scalar context. The return list's length corresponds to that of
the argument list: deleting non-existent elements returns the undefined value
-in their corresponding positions.
+in their corresponding positions. When a
+L<keyE<sol>value hash slice|perldata/KeyE<sol>Value Hash Slices> is passed to
+C<delete>, the return value is a list of key/value pairs (two elements for each
+item deleted from the hash).
L<C<delete>|/delete EXPR> may also be used on arrays and array slices,
but its behavior is less straightforward. Although