why we are getting the scalar value as the length of array
We don't. We get the count of all elements.
Reason is that the designer thought that was the most helpful thing to do under the circumstances, documented it to be so, and there we are. What would your preference have been?
If you want the combined length of all elements, use length and join to get it.
Cheers, Sören
Créateur des bugs mobiles - let loose once, run everywhere.
(hooked on the Perl Programming language)
In reply to Re: array in scalar context..
by Happy-the-monk
in thread array in scalar context..
by abhishekv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |