Thanks for the response. I've never used Pascal, so I can't comment there. The purpose of the nested subs was to avoid having to either declare multiple global (that is, file level) variables or pass multiple arguments and accept multiple returns via an array pointer or some such. I still don't understand why $flagvalue is retaining it's value when control clearly exits and reenters the parent sub (and the warnings don't make much sense either) but I'm rewriting the flow slightly and removing the nested subs (via the repugnant file level variables) and it seems to be working...