3 ms·
The core documentation is not always clear about the difference between lists and arrays--and much credit to the author for identifying the comma operator as an
by chromatic 13y ago
The core documentation is not always clear about the difference between lists and arrays--and much credit to the author for identifying the comma operator as an operator--but this is really confused:
By default, the arguments to a procedure are in the array context, which means that the comma operator expects both of its operands to be arrays. It promotes them to single-element arrays if they are scalars. In Perl, comma (,) can mean cons, append, flatten all at once.
I wrote an explanation of context in Perl which is hopefully clearer:
http://modernperlbooks.com/books/modern_perl/chapter_01.html#context http://modernperlbooks.com/books/modern_perl/chapter_01.html...