But shouldn't the alias be to the elements of the list returned by sort, not to the elements of the original list? Should sort sort a copy of its argument and return the sorted copy?
> From [EMAIL PROTECTED] Thu Jul 21 10:10:59 2005 > Subject: [perl #36616] bug or feature? foreach (sort @array) {y/a-z/A-Z/;} # > @array modified! > From: "Andy Lester via RT" <[EMAIL PROTECTED]> > X-RT-Loop-Prevention: perl > RT-Ticket: perl #36616 > Managed-by: RT 3.0.11 (http://www.bestpractical.com/rt/) > RT-Originator: [EMAIL PROTECTED] > To: [EMAIL PROTECTED] > X-RT-Original-Encoding: utf-8 > Date: Thu, 21 Jul 2005 07:08:13 -0700 > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > > Yes, this is correct. The loop variable is an alias. > This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html