Imagine your stack goes from left to right like this:
1 2 3 4
pop($stack) removes the 1 from the left of the stack and you're left with
2 3 4
push($stack, 5) pushes 5 on to the left of the stack so you're left with
5 2 3 4
Normally people think of stacks vertically with what I've called the left at the top.
HTH
--
Charlie Harvey's website - linux, perl, java, anarchism and punk rock:
http://charlieharvey.org.uk