As rafl said, this can be achieved using symbolic links, but they are quite dangerous (they are a vector of code injection) and do not work with lexical variables (and should use lexical variables instead of package variables). Whenever you think you want a symbolic link, you almost certainly want a hash instead. Instead of saying:
#$this_is_test is really $main::this_is_test and is accessible from anywhere #including other packages if they use the $main::this_is_test form our $this_is_test = "what ever"; my $default = "this"; $default = ${ $default . "_is_test" };
You can say:
my %user_vars = ( this_is_test => "what ever" ); my $default = "this"; $default = $user_vars{ $default . "_is_test" };
This limits the scope of %user_vars block in which it was created, and the separation of keys from real variables limits the risk of injection attacks.
source share