1 |
push adds elements at end of a list (array). For example,
|
2 |
push(@stack, $new); # equivalent to @stack = (@stack, $new);
|
3 |
One can also use a list as the second arg in push:
|
4 |
push(@stack, 6, "next", @anotherlist);
|
5 |
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
|
6 |
unshift is similar to push, except it works on left (lowest indices) of list. For example,
|
7 |
unshift(@INC, $dir);
|
8 |
modifies the path for included files on-the-fly
|
9 |
shift is to pop as unshift is to push
|
10 |
reverse(@list) and sort(@list) leave @list unaltered, but returns reversed and sorted lists, respectively
|