package main; # some stuff here package RadCache; sub mangle_cache { # do this and that } #### package main; # stuff here my $sub_ref = sub { print "Messing with the cache.\n" }; *RadCache::mangle_cache = $sub_ref; # syntax may be a little off