In response to all this lively discourse, the problem continues in spite of a suitably scoped my @pileofinchis array. However, I have now found at least one problem which was indeed a scoping issue with an array.
use strict scares me :(
Thanks for your assistance