New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correction to the description of C<delete> #13744
Comments
From anno5@me.comThe description of C<delete> in perlfunc.pod says: ... This isn't quite correct. It isn't required for all deletions to be at the end of the string, shrinking happens if any of them are. I'd also add a sentence that gives the rationale for this seemingly unsystematic behavior. I suggest to change the passage to read (patch attached) However, if any deleted elements fall at the end of an array, |
From anno5@me.com |
From @tonycozOn Thu Apr 17 11:50:30 2014, anno5@me.com wrote:
That looks good to me. I'll apply it post 5.20. Attached is a git format-patch as I plan to apply it, using your email from the AUTHORS file instead of from this ticket. If you want that changed, please let me know. Tony |
From @tonycoz0001-perl-121681-fix-documentation-of-delete-at-the-end-o.patchFrom d69d48cf2a4a44e0544d0b8dc04948c6474802f9 Mon Sep 17 00:00:00 2001
From: Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
Date: Mon, 21 Apr 2014 10:16:07 +1000
Subject: [perl #121681] fix documentation of delete at the end of an array
---
pod/perlfunc.pod | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 9a5ee74..0cc1e9a 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -1368,9 +1368,10 @@ in their corresponding positions.
delete() may also be used on arrays and array slices, but its behavior is less
straightforward. Although exists() will return false for deleted entries,
deleting array elements never changes indices of existing values; use shift()
-or splice() for that. However, if all deleted elements fall at the end of an
+or splice() for that. However, if any deleted elements fall at the end of an
array, the array's size shrinks to the position of the highest element that
-still tests true for exists(), or to 0 if none do.
+still tests true for exists(), or to 0 if none do. In other words, an
+array won't have trailing nonexistent elements after a delete.
B<WARNING:> Calling delete on array values is deprecated and likely to
be removed in a future version of Perl.
--
1.7.10.4
|
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Sun Apr 20 17:24:06 2014, tonyc wrote:
Ricardo approved this for pre-5.20 on IRC last night[1], applied as deaf6ad. [1] from the perspective of GMT+1000 |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#121681 (status was 'resolved')
Searchable as RT121681$
The text was updated successfully, but these errors were encountered: