sub foo { my ($foo_target) = @_; no strict 'refs'; # Up to no good here ${"${foo_target}::foo"}++; }