The ... code [of the OP] ... leads ... the reader to think that bar() makes sense in the context of foo().
But does the code lead the reader to think that foo() does not make sense in the context of bar()? (See ikegami's Re: a sub within a sub -- revisiting.) If the code does not alert the reader to the subtle (side?) effect pointed out in that reply, it is not helpful and should either be heavily commented or another, more straightforward approach should be chosen to achieve the same effect. (Of course, this assumes the effect is intended in the first place!)