in reply to Re: problem : return an array list
in thread problem : return an array list

And perl will step through all the arrays in turn. Also works in function calls and any other place where perl expects an array. Nifty, eh?

Well, nifty - yes. Correct - no.

With for, perl expects a LIST, not an ARRAY. This is why for (1, 2, 3) also works.

splice, push, pop, shift and unshift expect an ARRAY as their first argument. The big difference is that where a LIST is expected, an array is flattened as in your example. When an ARRAY is expected, you can only use a single array, not two arrays, not a hash.

In the case of for (@array1, @array2, @array3), the list passed to for consists of all elements in the three arrays, not the three arrays themselves.

(Please note that uppercased "LIST" and "ARRAY" are conventions used throughout the Perl documentation)

U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk