From: Elizabeth Mattijsen Date: Sun, 14 Dec 2003 20:25:07 +0000 (+0100) Subject: [DOCPATCH] perlfunc delete X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eba0920a5263eaae74823c7a8cd8737fe6c7ab9f;p=p5sagit%2Fp5-mst-13.2.git [DOCPATCH] perlfunc delete Message-Id: p4raw-id: //depot/perl@21912 --- diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 7c69ff6..8b13ebd 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -1033,8 +1033,18 @@ In the case of an array, if the array elements happen to be at the end, the size of the array will shrink to the highest element that tests true for exists() (or 0 if no such element exists). -Returns each element so deleted or the undefined value if there was no such -element. Deleting from C<$ENV{}> modifies the environment. Deleting from +Returns a list with the same number of elements as the number of elements +for which deletion was attempted. Each element of that list consists of +either the value of the element deleted, or the undefined value. In scalar +context, this means that you get the value of the last element deleted (or +the undefined value if that element did not exist). + + %hash = (foo => 11, bar => 22, baz => 33); + $scalar = delete $hash{foo}; # $scalar is 11 + $scalar = delete @hash{qw(foo bar)}; # $scalar is 22 + @array = delete @hash{qw(foo bar baz)}; # @array is (undef,undef,33) + +Deleting from C<%ENV> modifies the environment. Deleting from a hash tied to a DBM file deletes the entry from the DBM file. Deleting from a Cd hash or array may not necessarily return anything.