- I don't understand the intent of your first sentence here. Are you objecting that the PM solution offered (seems to you) to vary from your instructor's directions? If so, trust choroba's trouble-shooting. Push (see also next graf) allows you to add new elements to an array. When inside a loop, assigning a value to the array REPLACES whatever was in the array on the last iteration of the loop.
- Perhaps your instructor mentioned using your command line to obtain local help;
C:\> perldoc -f push
or
C:\> perldoc -f grep
There are many more sources of help local to your computer. See, for instance,
perldoc perldoc and many others.
If you didn't program your executable by toggling in binary, it wasn't really programming!