my @vals = ( 'cat', 'dog', 'mouse' );
Let's push onto this array: push( @vals, 'tiger' );
print( join(',',@vals ) );
outputs cat,dog,mouse,tiger.
Let's pop from this array: print( pop( @vals ) );
outputs tiger.
Let's shift from this array: print( shift( @vals ) );
outputs cat.
Note that both shift and pop remove the value from the array that you obtained: print( join(',',@vals ) );
prints dog,mouse.
Finally delete isn't an array function, it's used for deleting a hash element... update: whoops Limbic~Region has pointed out I was wrong about the delete function.. read his comments below.
|