I've always wondered this.
Just about every tutorial on this topic talks about spring-loaded cafeteria trays. There are three main things wrong with this analogy:
- I have never eaten in a cafeteria with spring-loaded trays
- You might just conceivably "push" some new trays onto the top, so that term sort of fits the mental picture, but you don't "shift", "unshift" or "pop" cafeteria trays
- The tray stack can only be added to from the top, whereas perl functions allow us to add at either end.
So, how did they get those names?
I'm not sure what I would have called them, if Perl were just invented and Larry asked me to assign them names -- "append" and "prepend" maybe, are the best English equivalents for push and unshift? But the others don't really have obvious analogues.
($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')