in reply to I've never seen this before - $#a = 4 - ??

Assigning to $#a is a seldom-used way of truncating the array @a.   $#a = 4; arranges for the final index of @a to be 4. Hence, @a will hold 5 elements.

I find that using a slice makes the code more readable.   @a = @a[0..4];

Replies are listed 'Best First'.
•Re: Re: I've never seen this before - $#a = 4 - ??
by merlyn (Sage) on Jun 26, 2002 at 18:14 UTC