diff options
Diffstat (limited to 'pod/perldelta.pod')
-rw-r--r-- | pod/perldelta.pod | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 47f7c26651..b205c7480c 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -425,6 +425,22 @@ This is rather similar to how the arrow may be omitted from C<$foo[10]->{'foo'}>. Note however, that the arrow is still required for C<foo(10)->('bar')>. +=head2 exists() and delete() are supported on array elements + +The exists() and delete() builtins now work on simple arrays as well. +The behavior is similar to that on hash elements. + +exists() can be used to check whether an array element exists without +autovivifying it. If the array is tied, the EXISTS() method in the +corresponding tied package will be invoked. + +delete() may now be used to remove an element from the array and return +it. If the element happens to be the one at the end, the size of the +array also shrinks by one. If the array is tied, the DELETE() method +in the corresponding tied package will be invoked. + +See L<perlfunc/exists> and L<perlfunc/delete> for examples. + =head2 syswrite() ease-of-use The length argument of C<syswrite()> has become optional. @@ -812,6 +828,10 @@ been corrected. When applied to a pseudo-hash element, exists() now reports whether the specified value exists, not merely if the key is valid. +delete() now works on pseudo-hashes. When given a pseudo-hash element +or slice it deletes the values corresponding to the keys (but not the keys +themselves). See L<perlref/"Pseudo-hashes: Using an array as a hash">. + =head2 C<goto &sub> and AUTOLOAD The C<goto &sub> construct works correctly when C<&sub> happens |