I thought it might be helpful to others to note the subtle "gotcha" between defining variables with "my" and with "local" when using a construct such as $$ctm.
Or a construct such as $#$arrnm or $$arrnm[$$ctm]. That is to say, your @out_a, etc. arrays also cannot be lexical (my) variables.
The distinction isn't between my and local, it's between lexical and package variables. Symbolic refs (which look up a variable by an expression giving it's name) always find package variables, not lexical ones.