in reply to how internally $#array is working in Perl

Please explain me about how $#array is internally working.
Not much magic going on. Internally, an array is represented by an AV structure (a C struct). The first field points to an xpvav structure (another C struct). Here, the second field, called FILL, is an integer holding the current size of the array.

The size of the array, plus the value of $[ is enough to calculate the size of $#array.

Illustrated details.

Replies are listed 'Best First'.
Re^2: how internally $#array is working in Perl
by ikegami (Patriarch) on Aug 13, 2010 at 16:22 UTC
    Actually, because $#array can be used as an lvalue, a fair bit of magic is going on (including adding "magic" to both the returned scalar and the array in some circumstances). Fortunately, it is invisible to the user.