in reply to Scalar dereference error

It'll be easier to avoid this sort of bothersome (and embarrassing) glitch if you try one or more of the following strategies when writing your code:

Regarding the second point, maybe that long declaration line you posted is already properly "localized", such that all those variables really are required throughout the scope of the code block that contains that line. But if that code block is a whole big long script, you might need to think more carefully about design, and how to make your code more modular. At the very least, it may still be helpful to move some declarations closer to where they actually get used.

OTOH, if you are just declaring all your variables with "my" at the top of your script regardless of where they actually get used, then you are missing out on some of the important advantages of "use strict" and lexically scoped "my" variables.