http://qs321.pair.com?node_id=173988


in reply to Function Prototype Context Conversion

...why can't @foo be treated as an implicit list for DWIM purposes?
Because you asked Perl to treat it specially!

Think of it like this: when you say sub foo($), you're telling Perl to convert to a scalar the first arg of foo. When you say ``foo(@foo)'', you know that @foo has only one element (and therefore can assume you know what you mean), but perl doesn't. All perl looks at is the syntax of your code: an array is being used in a scalar context. So it gets converted to a scalar. Your "rule" for converting only works for 1-element lists; Perl's rule for converting an array to a scalar works for any size array.

It looks like another behaviour of Perl's conversion semantics that manages to confuse people.