in reply to changing source code in run time

The source code is a test file like any other, and can be edited.

But since perl first compiles a script before it runs the mainline code, changes in the source script don't change the runtime behavior, unless you force it to (for example with exec).

But maybe you are trying to solve an XY Problem - what do you want to achieve in the end? Maybe there's a better (simpler, more robust) way?