Pure Programmer
Blue Matrix


Cluster Map

Project: Array Last Element

Write a program that declares an integer array and initializes it with a number of values. Then have the program print out just the last element of the array. You can not hard code the index of the last element but must determine it dynamically from the array itself. Try changing the array initializer to test out arrays of differing lengths.

Output
$ perl ArrayLastElement.pl Array size is: 5 Last element is: 9

Solution