in reply to while(eval $c){} with self-modifying $c.
I'll go further, and guess that you'll be switching back and forth between n possible code snippets, where n is less than 100. In that case, use coderefs and an array or hash:
my @code = ( sub { print "This does something!\n" }, sub { print "This also does something!\n" }, ); for (@code) { $_->(); }
|
|---|