#!/usr/bin/perl

use strict;


main();

sub main {

#http://www.perl.com/doc/manual/html/pod/perlfunc.html

    my @arr = ("one","2","three","4","5");

    print "\n\nArray: \"@arr\"\n";

    print "We can access specific elements in the array using the [] notation...\n";
    #note!  the first element in the array is the 0th element, the second is 
    #the 1st element, etc...
    print "The second element is:  $arr[0] \n";

    #also, notice the concatenation operator .
    print "The third element is:  $arr[2] \n\n\n";  

    print "Add and Remove elements from the ends of an array\n\n";
    print "pop a value off the end of the array: \n\t" . pop(@arr) . "\n";
    print "\tremaining array \"@arr\"\n";
    print "shift a value off the begining of the array: \n\t" . shift(@arr) . "\n";
    print "\tremaining array \"@arr\"\n";

    print "push new val onto end: \n\t";
    push(@arr,"newEND");
    print "\tnew array \"@arr\"\n";

    print "unshift new val onto begining: \n\t";
    unshift(@arr,"newSTART");
    print "\tnew array \"@arr\"\n";

    print "Remove 3rd and 4th element\n";
    splice(@arr,2,2);
    print "\texcised array:  \'@arr\'\n";
    print "\n\n\nInsert 4 elements starting after the second element\n";
    my @new_vals_to_insert = ('A','B','C','D');
    splice(@arr,2,0,@new_vals_to_insert);
    print "\tarray with inserts:  @arr\n\n";

    print "\nReverse Array\n";
    my @rev_arr = reverse(@arr);
    print  "\treversed array: @rev_arr\n\n\n";


    



}

