in reply to Detecting type of output from subs

If I just collect everything in an array how do I tell if it returned a scalar or a single element list?

Well, if what the function returns depends on $run, you know ahead of time what mode it is in

This is really easy to avoid by documenting what the function returns, and always returning the same thing regardless of context