Re: [Boston.pm] delete($_[2]); doesn't
Uri Guttman <uri-X/[email protected]> Thu, 19 Dec 2019 17:33:04 -0500
| Newsgroups | gmane.comp.lang.perl.perl-mongers.boston |
|---|---|
| Organization | Perl Hunter |
| Message-ID | <[email protected]> |
On 12/19/19 5:22 PM, Conor Walsh wrote: > That's not how delete works in this context. Try $_[2]="changed!"; > > perldoc warns about delete on arrays: Calling "delete" on array values is strongly discouraged. The notion of deleting or checking the existence of Perl array elements is not conceptually coherent, and can lead to surprising behavior. perldoc -f delete has more on this. it does NOT remove the element or shift others down. use splice (or shift) for that. delete is really only for hashes. the whole concept of delete on arrays is goofy as the docs warn. uri _______________________________________________ Boston-pm mailing list [email protected] https://mail.pm.org/mailman/listinfo/boston-pm