Perl: Arrays
Arrays in Perl can be defined using @ sign as follows: @person = ("hari", "david", "mika"); @music = ("flute","guitar"); Thus, person is now an array with 3 elements in it and can accessed as an array variable through its indices:
Arrays can be added to another arrays as: @morepersons= ("tom", @person); Thus, array morepersons now contain 4 elements viz. tom, hari, david, mika. Another way of adding elements to the array is using push command: push(@person, "dick"); This would add dick to the person array at the last position i.e. after hari, david, mika which means index 3. More elements can be also be pushed into the array. Similarly, to remove the last item from a list and return it use the pop function. Thus, $lastPerson = pop(@person); # Now $lastPerson = "dick"
Arrays can also be used as follows:
$#person returns the index of the last element in in the array.

Recent comments
1 week 11 hours ago
2 weeks 5 days ago
4 weeks 19 hours ago
4 weeks 3 days ago
4 weeks 4 days ago
4 weeks 6 days ago
29 weeks 1 day ago
29 weeks 5 days ago
29 weeks 5 days ago
30 weeks 1 day ago