On Fri, 12 Apr 2002 [EMAIL PROTECTED] wrote: > > Eew. That looks like a bug in perl somewhere. > > shuffle 1 .. 10; # Fine. > shuffle 1, 2, 3, 4, 5, 6, 7, 8, 9, 10; # Not ok.
Well, if it's a bug, it's more in the design than in the code. Arguably both of the above should die, and arguably there should also be a generic (and non-obscure) mechanism to make both cases Work As Expected without having to force an explicit O(n)-memory array copy. The first step in fixing that would be to declare the return values of non-lvalue subs (and builtins) read-only. The second step would be to introduce some way (new builtin? attributes? special optimized list assignment?) to make all the elements of a list modifiable in such a way that an explicit copy is made only if absolutely necessary (may require messing with SV flags). The third step is dealing with the inevitable backwards compatibility issues... Want to submit a patch? -- Ilmari Karonen - http://www.sci.fi/~iltzu/ "I once bought a 'wand of long blue line creation'. That's what it said on the side and it worked, too." -- Jonathan L Cunningham in rasfc