I'm still working on issues with arrayrefs and hashrefs in the spectest suite. S02-literals/autoref.t:59 has the following:
# Implicit referentiation of arrays in assignment to an array element { my @array = <a b c>; my @other; @other[1] = @array; is [EMAIL PROTECTED], " a b c", '@other[$idx] = @array works (1)'; is [EMAIL PROTECTED], 2, '@other[$idx] = @array works (2)'; is [EMAIL PROTECTED], 3, '@other[$idx] = @array works (3)'; } The idea given by the test appears to be that the C< @other[1] = @array; > statement causes @other[1] to contain a reference to @array. After the statement, @other contains two elements, the second of which is an array of three elements. However, S03 and STD.pm seem to indicate that having @other[1] on the left would result in a list assignment, not an item assignment. As a list assignment, @other[1] would then get the first element from @array, and we'd get a warning about the leftover elements. By way of illustration, contrast the two assignments at the end of the following code: my @x = <a b>; my @y; @y[1] = @x, 'c'; @y[1,2,3] = @x, 'c'; The second assignment would seem to clearly be a list assignment, leaving @y with (undef, 'a', 'b', 'c'). But is the first assignment parsed as an item assignment or a list assignment? If it is parsed as an item assignment, how does the parser recognize it as such? If it's parsed as a list assignment, then should we be creating an Array reference here or merely assigning elements to the container on the left? Or am I missing something else altogether? Thanks in advance for any answers, Pm