push adds elements at end of a list (array). For example,
|
push(@stack, $new); # equivalent to @stack = (@stack, $new);
|
One can also use a list as the second arg in push:
|
push(@stack, 6, "next", @anotherlist);
|
pop, the inverse operator to push, removes and returns the last element in the list
-
Note chop(@stack) removes last character of each entry of @stack
|
unshift is similar to push, except it works on left (lowest indices) of list. For example,
|
unshift(@INC, $dir);
|
modifies the path for included files on-the-fly
|
shift is to pop as unshift is to push
|
reverse(@list) and sort(@list) leave @list unaltered, but returns reversed and sorted lists, respectively
|