Jano Svitok
4/2/2008 8:20:00 PM
On Wed, Apr 2, 2008 at 10:13 PM, Jeff Miller <loadeddesigns@gmail.com> wrote:
> Hello,
> Let's say I have an array like this:
>
> @name_array = ["john", "t.", "smith"]
>
> how can I get the first and LAST entries? IE:, I don't want the middle
> one or any in between. I know I can get the first entry by
> @name_array[0], but this will be part of a function in which some arrays
> will have 2 entries, others 3 or even more, and I just want the last
> entry. How can I do this?
quite surprisingly: @name_array.first and @name_array.last :)