> Date: Thu, 11 Apr 2002 16:10:27 +0200 > From: Eugene van der Pijll <[EMAIL PROTECTED]>
> No, values are modified, keys are not. But that's not so strange: hash > values are scalars; hash keys are strings: > > $ perl -le'$a{[1,2,3]} = [4,5,6]; print "$_: @$_" for %a' > ARRAY(0x140001ad0): > ARRAY(0x1400019e0): 4 5 6 > > s/// and other operators only work on scalar values, so a key has to be > copied into a scalar value to be assigned to $_. A hash value is already > a value, and can be aliased to $_. > > Does that make sense? Yes. By the way, the thing I was referring to earlier that only 'works' on 5.6.x was "map s///, sort %a" --- and that doesn't 'work' on 5.004, even though other variants like "for (sort @x) { s/// }" seem to. I don't have easy access myself to versions between 5.004 and 5.6, so I don't know when it changed exactly --- but I have reason to think it was recently. Lars Mathiesen (U of Copenhagen CS Dep) <[EMAIL PROTECTED]> (Humour NOT marked)