although the list (list1, list2, list3, list4) is questionable, since it contains bare words which might be interpreteted as subroutine callsWhether they are subroutine calls or not doesn't matter. It's a list because of the context - the RHS of a list assignment is always a list. The fact the assignment is a list assignment is caused by the LHS being an array.
qw returns a listNo, it doesn't. In Perl, it's not the operation (operator, subroutine, function) that determines whether a list or a scalar is returned - it's the context. It's always the context. qw in scalar context cannot return a list - there are no lists in scalar context.1
in an old release it used to return an arrayIn which release was that? And what does "returning an array" mean? Could I push on it? Slice from it? Did it have a name? Perhaps you're confused by the fact in earlier releases qw was calculated at run-time (by doing a split), and nowadays qw is calculated at compile time.
You can assign to a list on the left side, provided the list only consists of variables....You're contradiction yourself. First you say it assigns to a list, then you say it assigns to a three variables. It's actually the latter that happens.
...then assign from the array into the three variables $speed, $colour, $animal arranged in a list.
1Who will be the first one to claim this time there's such a thing as lists in scalar context?
In reply to Re^2: difference between array and list in perl
by JavaFan
in thread difference between array and list in perl
by manishrathi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |