Okey, just another simple problem to check how well you know Perl! contexts[perldata#Context]. Definitely this link is a good key to the problem below. But before checking documentation, consider the following code :
What can you expect it does? It does the following :
If you known this - great, but explanation for everyone who are not familiar with contexts may look quite straightforward, but I’ll say that there is nothing unexpected.
Second line print nothing as whole print expression expects LIST context variable, but in this context the list assignment result is the left side of assignment which is
(), so it prints nothing.
The last line prints scalar variable $count, value of which is derived from list assignment. But in scalar context list assignment result is the right side. What is the right side? Matches in scalar context which is exactly the number of elements int array.
So, that’s it!
Just to clarify top results, here is another snippet :