in reply to Re^10: Constant subroutine main::C redefined
in thread Constant subroutine main::C redefined

String eval for sub definition might be helpful here, though I don't know if that messes with the optimization. Minus that,
sub FOO(){23}; BEGIN{eval sprintf 'delete $%s::{FOO}', __PACKAGE__} sub FOO(){42};
might hit your need.

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.