in reply to array pushing

sulfericacid,
From perldoc -f push:
push ARRAY,LIST Treats ARRAY as a stack, and pushes the values of LIST onto the end of + ARRAY. The length of ARRAY increases by the length of LIST. Has the +same effect as for $value (LIST) { $ARRAY[++$#ARRAY] = $value; } but is more efficient. Returns the new number of elements in the array +.
Ok - you completely missed the part that says same effect as. The syntax for push is (see top line of documentation):
push @array , "new value";
The blurb from the documentation is saying that push treats the array like a stack. Imagine one of those bad cafeteria's that have the plates on a spring loaded stack. You push a new plate onto the stack it gets bigger, you pop one off by pulling the top plate off.

This example of code is doing the following:

  • For each item in a list (any list not just array), treat each item as $value
  • Find the last element of the array using $#ARRAY, and one to it with ++, and set that equal to $value
  • As a side effect, it returns the new number of elements in the array ( $newcount = push @array , "blah" ), you would get the total number of elements in the array

    That is the same thing as pushing a new plate on the stack.

    I hope this helps - L~R