perlquestion
Cody Pendant
I've always wondered this.
<P>
Just about every tutorial on this topic talks about spring-loaded cafeteria trays. There are three main things wrong with this analogy:
<ul><li>I have never eaten in a cafeteria with spring-loaded trays<li>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<li>The tray stack can only be added to from the top, whereas perl functions allow us to add at either end.</ul>
<P>So, how did they get those names?
<P>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.
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-87399">
<HR>
<BR>
<blockquote>
($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')<br>
=~y~b-v~a-z~s; print
</blockquote>
</div></div>