http://www.perlmonks.org?node_id=327488


in reply to Dereferencing and context?

I don't see why you would have expected the same output.

In the second example, $_ is an array ref and when you dereference it is an array (for all purposes here). Since you're concatenating to a string, it has to be a scalar value, and the scalar value of an array is the number of elements in that array. In the first example, you explicitly concatenate the elements of both arrays.

The difference is that in the first you are concatenating elements, and in the second you are concatenating the scalar values of two arrays.