On Thu, Jul 21, 2005 at 10:20:22AM -0400, Shiping Zhang wrote:
> 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?

That's what I'm thinking, that this is a sort/foreach optimization gone 
wrong.  foreach $_ works on aliases of the array its looping over but sort 
does NOT sort in place.  "foreach (sort @a)" should not loop over aliases
to @a any more than "foreach (map {$_} @a)" should.

Its a bug.


-- 
Michael G Schwern     [EMAIL PROTECTED]     http://www.pobox.com/~schwern
ROCKS FALL! EVERYONE DIES!
        http://www.somethingpositive.net/sp05032002.shtml

Reply via email to