JVromans@squirrel.nl (Johan Vromans) wrote > "M.J.T. Guy" <mjtg@cus.cam.ac.uk> writes: > > > And I cannot > > > see why 'scalar(@x)->[2]' produces the 3rd element of array @x. > > > > Where does it say anything about scalar context? > > As far as I can tell, scalar(@x) is 4, and 4->[2] points to nothing > defined, most certainly not to $x[2]. Oops. I interpreted your remark as if "@x->[2] is the same as scalar(@a)->[2] so it should behave ..." and I meant "Where does it say the LHS of -> is scalar context?. I didn't realise you meant a literal scalar($a). #perl -Mstrict -wle 'my @a=(7,6,5,4);print scalar(@a)->[2]' 5 # Eeeek! That *must* be a bug. Mike Guy