#!/usr/local/bin/perl

@myArray=split(/ /, "This string will be split");
print "My array is now >" . join(" ", @myArray) . "<\n";

# This takes a value from the start of the array, removing it from the array
$first=shift(@myArray);
print "I took $first from the start of the array.\n" . 
	"My array is now >" . join(" ", @myArray) . "<\n";

# This does the same with a value from the end of the array
$last=pop(@myArray);
print "I took $last from the end of the array.\n" . 
	"My array is now >" . join(" ", @myArray) . "<\n";

# This adds a value to the start of the array
unshift(@myArray, "Some");
print "I added something to the start of the array.\n" .
	"My array is now >" . join(" ", @myArray) . "<\n";

# And this adds a value to the end of the array
push(@myArray, "cut.");
print "I added something to the end of the array.\n" .
	"My array is now >" . join(" ", @myArray) . "<\n";
