1) Perl Arrays are 0 based arrays. So they start with 1.
2) For array, @item, $#item will give you the last index. Therefore the
array's count number of elements can be obtained from $#item + 1
3) scalar(@item) will give you the total count number of elements.
4)@item[4] will give you the 5th element. But it is not an array element. It
is actually a slice with one element. Don't worry about the gory details.
You will get it fast with your learning curve. For now, do not use @item[4]
but use $item[4]. That is the right way to go.

-- Rex

-----Original Message-----
From: Brian [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 22, 2001 9:46 PM
To: [EMAIL PROTECTED]
Subject: Assistance with Array.


#1  How can I tell the upper boundary limit of the array (IE, Max Entries)

#2  if I have an array: @item ... how can I see just the 5th element?
something like: print @item[5]; ??  Would that work?

Any assistance would be fantasic ... also, if that does work, does Perl 
start with 0 or with 1 as the base element?

Thanks a bunch!

Brian


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to