in reply to array in scalar context..

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)

Replies are listed 'Best First'.
Re^2: array in scalar context..
by marinersk (Priest) on Oct 30, 2013 at 13:44 UTC
    LOL

    "Length of the array" is an ambiguous term. He presupposes it means number of elements, you presuppose it means data storage length.

    However, count of all elements is not ambiguous, and is a decidedly better term.

    That said, I would guess the OP's native tongue is not English, so some leeway surely can be granted here?