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
24 weeks 10 hours ago
24 weeks 4 days ago
24 weeks 4 days ago
24 weeks 6 days ago
25 weeks 4 days ago
27 weeks 5 days ago
30 weeks 5 days ago
33 weeks 4 days ago
34 weeks 2 days ago
35 weeks 23 hours ago