in reply to using foreach

A few points unrelated to your immediate problem:

Minor variations on the line:

$var = pop (@stack1) + pop (@stack1);

will surprise you one day. It is not defined in what order the pops are executed. If the operator were / or . then the result may be quite different than you expected! The same issue occurs in the evaluation order of parameter lists and can cause very subtle bugs.


Perl reduces RSI - it saves typing